protected override object ReadPropertyValue(IPropertyBase propertyBase)
        {
            var property = propertyBase as IProperty;
            Debug.Assert(property != null && property.IsShadowProperty);

            return _propertyValues[property.GetShadowIndex()];
        }
        protected override void WritePropertyValue(IPropertyBase propertyBase, object value)
        {
            var property = propertyBase as IProperty;
            Debug.Assert(property != null && property.IsShadowProperty);

            _propertyValues[property.GetShadowIndex()] = value;
        }
        public virtual void PropertyChanged(InternalEntityEntry entry, IPropertyBase propertyBase, bool setModified)
        {
            if (_suspended)
            {
                return;
            }

            var property = propertyBase as IProperty;
            if (property != null)
            {
                entry.SetPropertyModified(property, setModified);

                if (property.GetRelationshipIndex() != -1)
                {
                    DetectKeyChange(entry, property);
                }
            }
            else
            {
                var navigation = propertyBase as INavigation;
                if (navigation != null)
                {
                    DetectNavigationChange(entry, navigation);
                }
            }
        }
        protected override object ReadPropertyValue(IPropertyBase propertyBase)
        {
            var property = propertyBase as IProperty;

            return property == null || !property.IsShadowProperty
                ? base.ReadPropertyValue(propertyBase)
                : _shadowValues[property.GetShadowIndex()];
        }
Example #5
0
        protected override int Index(IPropertyBase property)
        {
            Check.NotNull(property, "property");

            var asProperty = property as IProperty;

            return asProperty != null ? asProperty.OriginalValueIndex : -1;
        }
Example #6
0
 private int IndexChecked(IPropertyBase property)
 {
     var index = Index(property);
     if (index == -1)
     {
         ThrowInvalidIndexException(property);
     }
     return index;
 }
        protected override void WritePropertyValue(IPropertyBase propertyBase, object value)
        {
            Check.NotNull(propertyBase, "propertyBase");

            var property = propertyBase as IProperty;
            Contract.Assert(property != null && !property.IsClrProperty);

            _propertyValues[property.ShadowIndex] = value;
        }
        protected override object ReadPropertyValue(IPropertyBase propertyBase)
        {
            Check.NotNull(propertyBase, "propertyBase");

            var property = propertyBase as IProperty;
            Contract.Assert(property != null && !property.IsClrProperty);

            return _propertyValues[property.ShadowIndex];
        }
        protected override object ReadPropertyValue(IPropertyBase propertyBase)
        {
            Check.NotNull(propertyBase, "propertyBase");

            var property = propertyBase as IProperty;

            return property == null || property.IsClrProperty
                ? base.ReadPropertyValue(propertyBase)
                : _shadowValues[property.ShadowIndex];
        }
Example #10
0
        public virtual object this[IPropertyBase property]
        {
            get
            {
                var value = ReadValue(property);

                return value != null
                    ? (ReferenceEquals(value, NullSentinel.Value) ? null : value)
                    : _entry[property];
            }
            set { WriteValue(property, value ?? NullSentinel.Value); }
        }
        protected override void WritePropertyValue(IPropertyBase propertyBase, object value)
        {
            var property = propertyBase as IProperty;

            if (property == null
                || !property.IsShadowProperty)
            {
                base.WritePropertyValue(propertyBase, value);
            }
            else
            {
                _shadowValues[property.GetShadowIndex()] = value;
            }
        }
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used 
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        protected virtual Expression CreateConstructorExpression(
            [NotNull] IEntityType entityType,
            [CanBeNull] ParameterExpression parameter)
        {
            var count = GetPropertyCount(entityType);

            var types = new Type[count];
            var propertyBases = new IPropertyBase[count];

            foreach (var propertyBase in entityType.GetPropertiesAndNavigations())
            {
                var index = GetPropertyIndex(propertyBase);

                if (index >= 0)
                {
                    types[index] = (propertyBase as IProperty)?.ClrType ?? typeof(object);
                    propertyBases[index] = propertyBase;
                }
            }

            Expression constructorExpression;
            if (count > Snapshot.MaxGenericTypes)
            {
                var snapshotExpressions = new List<Expression>();

                for (var i = 0; i < count; i += Snapshot.MaxGenericTypes)
                {
                    snapshotExpressions.Add(
                        CreateSnapshotExpression(
                            entityType.ClrType,
                            parameter,
                            types.Skip(i).Take(Snapshot.MaxGenericTypes).ToArray(),
                            propertyBases.Skip(i).Take(Snapshot.MaxGenericTypes).ToList()));
                }

                constructorExpression =
                    Expression.Convert(
                        Expression.New(
                            MultiSnapshot.Constructor,
                            Expression.NewArrayInit(typeof(ISnapshot), snapshotExpressions)),
                        typeof(ISnapshot));
            }
            else
            {
                constructorExpression = CreateSnapshotExpression(entityType.ClrType, parameter, types, propertyBases);
            }
            return constructorExpression;
        }
Example #13
0
        protected override void WritePropertyValue(IPropertyBase propertyBase, object value)
        {
            Check.NotNull(propertyBase, "propertyBase");

            var property = propertyBase as IProperty;

            if (property == null
                || property.IsClrProperty)
            {
                base.WritePropertyValue(propertyBase, value);
            }
            else
            {
                _shadowValues[property.ShadowIndex] = value;
            }
        }
        public virtual void PropertyChanging(InternalEntityEntry entry, IPropertyBase propertyBase)
        {
            if (_suspended)
            {
                return;
            }

            if (!entry.EntityType.UseEagerSnapshots())
            {
                entry.EnsureOriginalValues();

                if (propertyBase.GetRelationshipIndex() != -1)
                {
                    entry.EnsureRelationshipSnapshot();
                }
            }
        }
Example #15
0
        public virtual object this[IPropertyBase property]
        {
            get
            {
                Check.NotNull(property, "property");

                var value = ReadValue(property);

                return value != null
                    ? (ReferenceEquals(value, NullSentinel.Value) ? null : value)
                    : _stateEntry[property];
            }
            set
            {
                Check.NotNull(property, "property");

                WriteValue(property, value ?? NullSentinel.Value);
            }
        }
        public virtual void PropertyChanging(InternalEntityEntry entry, IPropertyBase propertyBase)
        {
            if (!entry.EntityType.UseEagerSnapshots())
            {
                var property = propertyBase as IProperty;
                if (property != null
                    && property.GetOriginalValueIndex() >= 0)
                {
                    entry.OriginalValues.EnsureSnapshot(property);
                }

                var navigation = propertyBase as INavigation;
                if ((navigation != null && !navigation.IsCollection())
                    || (property != null && (property.IsKey() || property.IsForeignKey(entry.EntityType))))
                {
                    // TODO: Consider making snapshot temporary here since it is no longer required after PropertyChanged is called
                    // See issue #730
                    entry.RelationshipsSnapshot.TakeSnapshot(propertyBase);
                }
            }
        }
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used 
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public virtual void PropertyChanging(InternalEntityEntry entry, IPropertyBase propertyBase)
        {
            if (_suspended || entry.EntityState == EntityState.Detached)
            {
                return;
            }

            if (!entry.EntityType.UseEagerSnapshots())
            {
                var asProperty = propertyBase as IProperty;
                if (asProperty != null
                    && asProperty.GetOriginalValueIndex() != -1)
                {
                    entry.EnsureOriginalValues();
                }

                if (propertyBase.GetRelationshipIndex() != -1)
                {
                    entry.EnsureRelationshipSnapshot();
                }
            }
        }
        protected override object CopyValueFromEntry(IPropertyBase property)
        {
            var value = base.CopyValueFromEntry(property);

            var navigation = property as INavigation;
            if (value == null
                || navigation == null
                || !navigation.IsCollection())
            {
                return value;
            }

            // TODO: Perf: Consider updating the snapshot with what has changed rather than making a new snapshot every time.
            // TODO: This may need to be strongly typed to entity type--not just object
            var snapshot = new HashSet<object>(ReferenceEqualityComparer.Instance);

            foreach (var entity in (IEnumerable)value)
            {
                snapshot.Add(entity);
            }

            return snapshot;
        }
        public virtual void PropertyChanged(InternalEntityEntry entry, IPropertyBase propertyBase)
        {
            var snapshot = entry.TryGetSidecar(Sidecar.WellKnownNames.RelationshipsSnapshot);

            var property = propertyBase as IProperty;
            if (property != null)
            {
                entry.SetPropertyModified(property);

                if (snapshot != null)
                {
                    DetectKeyChange(entry, property, snapshot);
                }
            }
            else
            {
                var navigation = propertyBase as INavigation;
                if (navigation != null
                    && snapshot != null)
                {
                    DetectNavigationChange(entry, navigation, snapshot);
                }
            }
        }
Example #20
0
        protected override object ReadValue(IPropertyBase property)
        {
            Check.NotNull(property, "property");

            return _values[IndexChecked(property)];
        }
Example #21
0
 /// <summary>
 ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
 ///     directly from your code. This API may change or be removed in future releases.
 /// </summary>
 protected override int GetPropertyIndex(IPropertyBase propertyBase)
 => propertyBase.GetStoreGeneratedIndex();
 protected override void WriteValue(IPropertyBase property, object value)
     => _values[((IProperty)property).Index] = value;
Example #23
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public StructuralCurrentValueComparer([NotNull] IPropertyBase property)
     : base(property, StructuralComparisons.StructuralComparer)
 {
 }
Example #24
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public static int GetShadowIndex([NotNull] this IPropertyBase property)
 => property.GetPropertyIndexes().ShadowIndex;
Example #25
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 protected abstract TAccessor CreateGeneric <TEntity, TValue, TNonNullableEnumValue>(
     [CanBeNull] MemberInfo memberInfo,
     [CanBeNull] IPropertyBase propertyBase)
     where TEntity : class;
Example #26
0
 protected override object ReadPropertyValue(IPropertyBase property)
 {
     return _propertyBag[property.ColumnName()];
 }
Example #27
0
 public override bool CanStoreValue(IPropertyBase property) => Index(property) != -1;
Example #28
0
 protected abstract void ThrowInvalidIndexException([NotNull] IPropertyBase property);
Example #29
0
 protected abstract int Index([NotNull] IPropertyBase property);
Example #30
0
 static Expression CreateMemberAssignment(Expression parameter, MemberInfo memberInfo, IPropertyBase property, Expression value)
 {
     return(property.IsIndexerProperty()
         ? Expression.Assign(
                Expression.MakeIndex(
                    parameter, (PropertyInfo)memberInfo, new List <Expression> {
         Expression.Constant(property.Name)
     }),
                value)
         : Expression.MakeMemberAccess(parameter, memberInfo).Assign(value));
 }
 public T GetValue <T>(InternalEntityEntry entry, IPropertyBase propertyBase, int index)
 => IsEmpty
         ? entry.GetCurrentValue <T>(propertyBase)
         : _values.GetValue <T>(index);
 public object GetValue(InternalEntityEntry entry, IPropertyBase propertyBase)
 => IsEmpty ? entry[propertyBase] : _values[propertyBase.GetRelationshipIndex()];
Example #33
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public override IClrPropertySetter Create(IPropertyBase property)
 => property as IClrPropertySetter ?? Create(property.GetMemberInfo(forMaterialization: false, forSet: true), property);
Example #34
0
 public void PropertyChanging(InternalEntityEntry entry, IPropertyBase property)
 {
 }
Example #35
0
 protected virtual void CopyValueToEntry(IPropertyBase property, object value)
 {
     _stateEntry[property] = value;
 }
Example #36
0
 protected override object ReadValue(IPropertyBase property) => _values[IndexChecked(property)];
Example #37
0
 public override object this[IPropertyBase property]
 {
     get { return ReadPropertyValue(property); }
     set { WritePropertyValue(property, value); }
 }
Example #38
0
 protected override void WriteValue(IPropertyBase property, object value) => _values[IndexChecked(property)] = value;
Example #39
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public static int GetStoreGeneratedIndex([NotNull] this IPropertyBase propertyBase)
 => propertyBase.GetPropertyIndexes().StoreGenerationIndex;
 private void HandleChanging(IInvocation invocation, IPropertyBase property, IEqualityComparer comparer)
 {
     if (_checkEquality)
     {
         var oldValue = property.GetGetter().GetClrValue(invocation.Proxy);
         var newValue = invocation.Arguments[^ 1];
        public static PropertyIndexes CalculateIndexes([NotNull] this IEntityType entityType, [NotNull] IPropertyBase propertyBase)
        {
            var index                = 0;
            var shadowIndex          = 0;
            var originalValueIndex   = 0;
            var relationshipIndex    = 0;
            var storeGenerationIndex = 0;

            var baseCounts = entityType.BaseType?.GetCounts();

            if (baseCounts != null)
            {
                index                = baseCounts.PropertyCount;
                shadowIndex          = baseCounts.ShadowCount;
                originalValueIndex   = baseCounts.OriginalValueCount;
                relationshipIndex    = baseCounts.RelationshipCount;
                storeGenerationIndex = baseCounts.StoreGeneratedCount;
            }

            PropertyIndexes callingPropertyIndexes = null;

            foreach (var property in entityType.GetDeclaredProperties())
            {
                var indexes = new PropertyIndexes(
                    index++,
                    property.RequiresOriginalValue() ? originalValueIndex++ : -1,
                    property.IsShadowProperty ? shadowIndex++ : -1,
                    property.IsKeyOrForeignKey() ? relationshipIndex++ : -1,
                    MayBeStoreGenerated(property) ? storeGenerationIndex++ : -1);

                TrySetIndexes(property, indexes);

                if (propertyBase == property)
                {
                    callingPropertyIndexes = indexes;
                }
            }

            foreach (var navigation in entityType.GetDeclaredNavigations())
            {
                var indexes = new PropertyIndexes(index++, -1, -1, relationshipIndex++, -1);

                TrySetIndexes(navigation, indexes);

                if (propertyBase == navigation)
                {
                    callingPropertyIndexes = indexes;
                }
            }

            foreach (var derivedType in entityType.GetDirectlyDerivedTypes())
            {
                derivedType.CalculateIndexes(propertyBase);
            }

            return(callingPropertyIndexes);
        }
Example #42
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public StructuralEntryCurrentValueComparer(IPropertyBase property)
     : base(property, StructuralComparisons.StructuralComparer)
 {
 }
 protected override object ReadValue(IPropertyBase property)
     => _values[((IProperty)property).Index] ?? NullSentinel.Value;
Example #44
0
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public static bool TryGetMemberInfo(
            [NotNull] this IPropertyBase propertyBase,
            bool forConstruction,
            bool forSet,
            out MemberInfo memberInfo,
            out string errorMessage)
        {
            memberInfo   = null;
            errorMessage = null;

            var propertyInfo   = propertyBase.PropertyInfo;
            var fieldInfo      = propertyBase.FieldInfo;
            var setterProperty = propertyInfo?.FindSetterProperty();
            var getterProperty = propertyInfo?.FindGetterProperty();

            var isCollectionNav = (propertyBase as INavigation)?.IsCollection == true;
            var hasField        = fieldInfo != null;
            var hasSetter       = setterProperty != null;
            var hasGetter       = getterProperty != null;

            var mode = propertyBase.GetPropertyAccessMode();

            if (forConstruction)
            {
                if (mode == PropertyAccessMode.Field ||
                    mode == PropertyAccessMode.FieldDuringConstruction)
                {
                    if (hasField)
                    {
                        memberInfo = fieldInfo;
                        return(true);
                    }

                    if (isCollectionNav)
                    {
                        return(true);
                    }

                    errorMessage = GetNoFieldErrorMessage(propertyBase);
                    return(false);
                }

                if (mode == PropertyAccessMode.Property)
                {
                    if (hasSetter)
                    {
                        memberInfo = setterProperty;
                        return(true);
                    }

                    if (isCollectionNav)
                    {
                        return(true);
                    }

                    errorMessage = hasGetter
                        ? CoreStrings.NoSetter(propertyBase.Name, propertyBase.DeclaringType.DisplayName(), nameof(PropertyAccessMode))
                        : CoreStrings.NoProperty(fieldInfo?.Name, propertyBase.DeclaringType.DisplayName(), nameof(PropertyAccessMode));

                    return(false);
                }

                if (mode == PropertyAccessMode.PreferField ||
                    mode == PropertyAccessMode.PreferFieldDuringConstruction)
                {
                    if (hasField)
                    {
                        memberInfo = fieldInfo;
                        return(true);
                    }

                    if (hasSetter)
                    {
                        memberInfo = setterProperty;
                        return(true);
                    }
                }

                if (mode == PropertyAccessMode.PreferProperty)
                {
                    if (hasSetter)
                    {
                        memberInfo = setterProperty;
                        return(true);
                    }

                    if (hasField)
                    {
                        memberInfo = fieldInfo;
                        return(true);
                    }
                }

                if (isCollectionNav)
                {
                    return(true);
                }

                errorMessage = CoreStrings.NoFieldOrSetter(propertyBase.Name, propertyBase.DeclaringType.DisplayName());
                return(false);
            }

            if (forSet)
            {
                if (mode == PropertyAccessMode.Field)
                {
                    if (hasField)
                    {
                        memberInfo = fieldInfo;
                        return(true);
                    }

                    if (isCollectionNav)
                    {
                        return(true);
                    }

                    errorMessage = GetNoFieldErrorMessage(propertyBase);
                    return(false);
                }

                if (mode == PropertyAccessMode.Property)
                {
                    if (hasSetter)
                    {
                        memberInfo = setterProperty;
                        return(true);
                    }

                    if (isCollectionNav)
                    {
                        return(true);
                    }

                    errorMessage = hasGetter
                        ? CoreStrings.NoSetter(propertyBase.Name, propertyBase.DeclaringType.DisplayName(), nameof(PropertyAccessMode))
                        : CoreStrings.NoProperty(fieldInfo?.Name, propertyBase.DeclaringType.DisplayName(), nameof(PropertyAccessMode));

                    return(false);
                }

                if (mode == PropertyAccessMode.PreferField)
                {
                    if (hasField)
                    {
                        memberInfo = fieldInfo;
                        return(true);
                    }

                    if (hasSetter)
                    {
                        memberInfo = setterProperty;
                        return(true);
                    }
                }

                if (mode == PropertyAccessMode.PreferProperty ||
                    mode == PropertyAccessMode.FieldDuringConstruction ||
                    mode == PropertyAccessMode.PreferFieldDuringConstruction)
                {
                    if (hasSetter)
                    {
                        memberInfo = setterProperty;
                        return(true);
                    }

                    if (hasField)
                    {
                        memberInfo = fieldInfo;
                        return(true);
                    }
                }

                if (isCollectionNav)
                {
                    return(true);
                }

                errorMessage = CoreStrings.NoFieldOrSetter(propertyBase.Name, propertyBase.DeclaringType.DisplayName());
                return(false);
            }

            // forGet
            if (mode == PropertyAccessMode.Field)
            {
                if (hasField)
                {
                    memberInfo = fieldInfo;
                    return(true);
                }

                errorMessage = GetNoFieldErrorMessage(propertyBase);
                return(false);
            }

            if (mode == PropertyAccessMode.Property)
            {
                if (hasGetter)
                {
                    memberInfo = getterProperty;
                    return(true);
                }

                errorMessage = hasSetter
                    ? CoreStrings.NoGetter(propertyBase.Name, propertyBase.DeclaringType.DisplayName(), nameof(PropertyAccessMode))
                    : CoreStrings.NoProperty(fieldInfo?.Name, propertyBase.DeclaringType.DisplayName(), nameof(PropertyAccessMode));

                return(false);
            }

            if (mode == PropertyAccessMode.PreferField)
            {
                if (hasField)
                {
                    memberInfo = fieldInfo;
                    return(true);
                }

                if (hasGetter)
                {
                    memberInfo = getterProperty;
                    return(true);
                }
            }

            if (mode == PropertyAccessMode.PreferProperty ||
                mode == PropertyAccessMode.FieldDuringConstruction ||
                mode == PropertyAccessMode.PreferFieldDuringConstruction)
            {
                if (hasGetter)
                {
                    memberInfo = getterProperty;
                    return(true);
                }

                if (hasField)
                {
                    memberInfo = fieldInfo;
                    return(true);
                }
            }

            errorMessage = CoreStrings.NoFieldOrGetter(propertyBase.Name, propertyBase.DeclaringType.DisplayName());
            return(false);
        }
        private static FilterDefinition <TEntity> GetPropertyFilterDefinition <TEntity>(IPropertyBase property, object propertyValue)
        {
            ParameterExpression parameterExpression = Expression.Parameter(typeof(TEntity), name: "entity");
            LambdaExpression    lambdaExpression    = Expression.Lambda(
                Expression.MakeMemberAccess(parameterExpression, property.PropertyInfo),
                parameterExpression);

            return((FilterDefinition <TEntity>) typeof(FilterDefinitionBuilder <TEntity>)
                   .GetTypeInfo()
                   .GetDeclaredMethods(nameof(FilterDefinitionBuilder <TEntity> .Eq))
                   .First(methodInfo => methodInfo.GetParameters().Length == 2 &&
                          methodInfo.GetParameters()[0].ParameterType.GetTypeInfo().IsGenericType&&
                          methodInfo.GetParameters()[0].ParameterType.GetTypeInfo().GetGenericTypeDefinition() == typeof(Expression <>))
                   .GetGenericMethodDefinition()
                   .MakeGenericMethod(property.ClrType)
                   .Invoke(Builders <TEntity> .Filter, new[] { lambdaExpression, propertyValue }));
        }
Example #46
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 // Note: only use this to find the property/field that defines the property in the model. Use
 // GetMemberInfo to get the property/field to use, which may be different.
 public static MemberInfo GetIdentifyingMemberInfo(
     [NotNull] this IPropertyBase propertyBase)
 => propertyBase.PropertyInfo ?? (MemberInfo)propertyBase.FieldInfo;
Example #47
0
        public override bool CanStoreValue(IPropertyBase property)
        {
            Check.NotNull(property, "property");

            return Index(property) != -1;
        }
Example #48
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public static PropertyAccessors GetPropertyAccessors([NotNull] this IPropertyBase propertyBase)
 => propertyBase.AsPropertyBase().Accessors;
Example #49
0
        protected override void WriteValue(IPropertyBase property, object value)
        {
            Check.NotNull(property, "property");

            _values[IndexChecked(property)] = value;
        }
Example #50
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public static PropertyIndexes GetPropertyIndexes([NotNull] this IPropertyBase propertyBase)
 => propertyBase.AsPropertyBase()?.PropertyIndexes;
Example #51
0
 protected virtual object CopyValueFromEntry(IPropertyBase property)
 {
     return _stateEntry[property];
 }
Example #52
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public static int GetOriginalValueIndex([NotNull] this IPropertyBase propertyBase)
 => propertyBase.GetPropertyIndexes().OriginalValueIndex;
Example #53
0
 public void PropertyChanged(InternalEntityEntry entry, IPropertyBase property, bool setModifed)
 {
 }
Example #54
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public static int GetRelationshipIndex([NotNull] this IPropertyBase propertyBase)
 => propertyBase.GetPropertyIndexes().RelationshipIndex;
Example #55
0
 protected override void WritePropertyValue(IPropertyBase property, object value)
 {
     _propertyBag[property.ColumnName()] = value;
 }
Example #56
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public static PropertyBase AsPropertyBase(
     [NotNull] this IPropertyBase propertyBase, [NotNull][CallerMemberName] string methodName = "")
 => MetadataExtensions.AsConcreteMetadataType <IPropertyBase, PropertyBase>(propertyBase, methodName);
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 protected virtual Expression CreateReadShadowValueExpression(
     [CanBeNull] ParameterExpression parameter, [NotNull] IPropertyBase property)
 => Expression.Call(
     parameter,
     InternalEntityEntry.ReadShadowValueMethod.MakeGenericMethod(property.ClrType),
     Expression.Constant(property.GetShadowIndex()));
Example #58
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public abstract TAccessor Create([NotNull] IPropertyBase property);
 public void PropertyChanging(InternalEntityEntry entry, IPropertyBase property)
 {
 }
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public static Expression CreateEFPropertyExpression(
     [NotNull] this Expression target,
     [NotNull] IPropertyBase property,
     bool makeNullable = true)
 => CreateEFPropertyExpression(target, property.DeclaringType.ClrType, property.ClrType, property.Name, makeNullable);