Skip to content

Commit 9af9183

Browse files
authored
Fixes spelling mistake in FieldInfo public interface (#59)
1 parent 836898b commit 9af9183

File tree

5 files changed

+50
-39
lines changed

5 files changed

+50
-39
lines changed

Orm/Xtensive.Orm/Orm/Linq/Materialization/ExpressionMaterializer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2003-2010 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2009-2020 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Alexey Gamzov
55
// Created: 2009.05.21
66

@@ -446,7 +446,7 @@ private Expression MaterializeThroughOwner(Expression target, Expression tuple,
446446
var owner = field.Owner;
447447
var materializedOwner = MaterializeThroughOwner((Expression) owner, tuple, defaultIfEmpty);
448448
Expression fieldExpression;
449-
if (field.Field.IsDynalicallyDefined) {
449+
if (field.Field.IsDynamicallyDefined) {
450450
var attributes = materializedOwner.Type.GetCustomAttributes(typeof (DefaultMemberAttribute), true);
451451
var indexerPropertyName = ((DefaultMemberAttribute) attributes.Single()).MemberName;
452452
var methodInfo = materializedOwner.Type.GetProperty(indexerPropertyName).GetGetMethod();

Orm/Xtensive.Orm/Orm/Linq/QueryHelper.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2003-2010 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2009-2020 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Denis Krjuchkov
55
// Created: 2009.04.02
66

@@ -83,9 +83,9 @@ public static Expression CreateDirectEntitySetQuery(EntitySetBase entitySet)
8383
var wrapper = Activator.CreateInstance(
8484
typeof (OwnerWrapper<>).MakeGenericType(owner.GetType()), owner);
8585
var wrappedOwner = Expression.Property(Expression.Constant(wrapper), "Owner");
86-
if (!entitySet.Field.IsDynalicallyDefined)
86+
if (!entitySet.Field.IsDynamicallyDefined) {
8787
return Expression.Property(wrappedOwner, entitySet.Field.UnderlyingProperty);
88-
88+
}
8989
var indexers = owner.GetType().GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
9090
.Where(p => p.GetIndexParameters().Any())
9191
.Select(p => p.GetGetMethod());
@@ -94,10 +94,12 @@ public static Expression CreateDirectEntitySetQuery(EntitySetBase entitySet)
9494

9595
public static Expression CreateEntitySetQuery(Expression ownerEntity, FieldInfo field)
9696
{
97-
if (!field.IsDynalicallyDefined && !field.UnderlyingProperty.PropertyType.IsOfGenericType(typeof (EntitySet<>)))
97+
if (!field.IsDynamicallyDefined && !field.UnderlyingProperty.PropertyType.IsOfGenericType(typeof(EntitySet<>))) {
9898
throw Exceptions.InternalError(Strings.ExFieldMustBeOfEntitySetType, OrmLog.Instance);
99-
if (field.IsDynalicallyDefined && !field.ValueType.IsOfGenericType(typeof (EntitySet<>)))
99+
}
100+
if (field.IsDynamicallyDefined && !field.ValueType.IsOfGenericType(typeof(EntitySet<>))) {
100101
throw Exceptions.InternalError(Strings.ExFieldMustBeOfEntitySetType, OrmLog.Instance);
102+
}
101103

102104
var elementType = field.ItemType;
103105
var association = field.Associations.Last();

Orm/Xtensive.Orm/Orm/Linq/Translator.Expressions.cs

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2003-2010 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2009-2020 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Alexis Kochetov
55
// Created: 2009.02.27
66

@@ -924,13 +924,16 @@ private IList<Expression> GetStructureFields(
924924

925925
var result = new List<Expression>();
926926
foreach (PersistentFieldExpression fieldExpression in structureFields) {
927-
if (!structureType.GetProperties(BindingFlags.Instance | BindingFlags.Public).Contains(fieldExpression.UnderlyingProperty))
928-
if (!context.Model.Types[structureType].Fields[fieldExpression.Name].IsDynalicallyDefined)
927+
if (!structureType.GetProperties(BindingFlags.Instance | BindingFlags.Public).Contains(fieldExpression.UnderlyingProperty)) {
928+
if (!context.Model.Types[structureType].Fields[fieldExpression.Name].IsDynamicallyDefined) {
929929
continue;
930+
}
931+
}
930932
Type nullableType = fieldExpression.Type.ToNullable();
931933
Expression propertyAccessorExpression;
932-
if (fieldExpression.UnderlyingProperty!=null)
934+
if (fieldExpression.UnderlyingProperty!=null) {
933935
propertyAccessorExpression = Expression.MakeMemberAccess(Expression.Convert(expression, structureType), fieldExpression.UnderlyingProperty);
936+
}
934937
else {
935938
var attributes = structureType.GetCustomAttributes(typeof(DefaultMemberAttribute), true);
936939
var indexerPropertyName = ((DefaultMemberAttribute)attributes.Single()).MemberName;
@@ -945,23 +948,23 @@ private IList<Expression> GetStructureFields(
945948
nullableType));
946949

947950
switch (fieldExpression.GetMemberType()) {
948-
case MemberType.Entity:
949-
IEnumerable<Type> keyFieldTypes = context
950-
.Model
951-
.Types[fieldExpression.Type]
952-
.Key
953-
.TupleDescriptor;
954-
result.AddRange(GetEntityFields(memberExpression, keyFieldTypes));
955-
break;
956-
case MemberType.Structure:
957-
var structureFieldExpression = (StructureFieldExpression) fieldExpression;
958-
result.AddRange(GetStructureFields(memberExpression, structureFieldExpression.Fields, structureFieldExpression.Type));
959-
break;
960-
case MemberType.Primitive:
961-
result.Add(memberExpression);
962-
break;
963-
default:
964-
throw new NotSupportedException();
951+
case MemberType.Entity:
952+
IEnumerable<Type> keyFieldTypes = context
953+
.Model
954+
.Types[fieldExpression.Type]
955+
.Key
956+
.TupleDescriptor;
957+
result.AddRange(GetEntityFields(memberExpression, keyFieldTypes));
958+
break;
959+
case MemberType.Structure:
960+
var structureFieldExpression = (StructureFieldExpression) fieldExpression;
961+
result.AddRange(GetStructureFields(memberExpression, structureFieldExpression.Fields, structureFieldExpression.Type));
962+
break;
963+
case MemberType.Primitive:
964+
result.Add(memberExpression);
965+
break;
966+
default:
967+
throw new NotSupportedException();
965968
}
966969
}
967970
return result;

Orm/Xtensive.Orm/Orm/Model/FieldInfo.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,13 @@ public ColumnInfoCollection Columns {
661661
/// <summary>
662662
/// Gets a value indicating whether field is dynamically defined.
663663
/// </summary>
664-
public bool IsDynalicallyDefined { get { return UnderlyingProperty==null; } }
664+
[Obsolete("Use IsDynamicallyDefined property")]
665+
public bool IsDynalicallyDefined => IsDynamicallyDefined;
666+
667+
/// <summary>
668+
/// Gets a value indicating whether field is dynamically defined.
669+
/// </summary>
670+
public bool IsDynamicallyDefined => UnderlyingProperty == null;
665671

666672
private void GetColumns(ColumnInfoCollection result)
667673
{

Orm/Xtensive.Orm/Orm/Operations/EntitySetOperation.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2003-2010 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2009-2020 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Alexis Kochetov
55
// Created: 2009.11.20
66

@@ -44,7 +44,7 @@ protected EntitySetOperation(Key key, FieldInfo field)
4444
{
4545
Type fieldType;
4646
string fieldName = string.Empty;
47-
if (field.IsDynalicallyDefined) {
47+
if (field.IsDynamicallyDefined) {
4848
fieldType = field.ValueType;
4949
var name = field.Name;
5050
}

0 commit comments

Comments
 (0)