예제 #1
0
        public virtual Sidecar CreateStoreGeneratedValues([NotNull] StateEntry stateEntry, [NotNull] IReadOnlyList <IProperty> properties)
        {
            Check.NotNull(stateEntry, "stateEntry");
            Check.NotNull(properties, "properties");

            return(_storeGeneratedValuesFactory.Create(stateEntry, properties));
        }
예제 #2
0
        private void PrincipalKeyPropertyChangedAction(StateEntry entry, IProperty property, object oldValue, object newValue)
        {
            foreach (var foreignKey in _model.Service.EntityTypes.SelectMany(
                         e => e.ForeignKeys.Where(f => f.ReferencedProperties.Contains(property))))
            {
                var newKeyValues = foreignKey.ReferencedProperties.Select(p => entry[p]).ToList();
                var oldKey       = entry.RelationshipsSnapshot.GetPrincipalKeyValue(foreignKey);

                foreach (var dependent in entry.StateManager.StateEntries.Where(
                             e => e.EntityType == foreignKey.EntityType &&
                             oldKey.Equals(e.GetDependentKeyValue(foreignKey))).ToList())
                {
                    if (dependent.TryGetSidecar(Sidecar.WellKnownNames.StoreGeneratedValues) == null)
                    {
                        dependent.AddSidecar(_storeGeneratedValuesFactory.Create(dependent));
                    }
                    SetForeignKeyValue(dependent, foreignKey.Properties, newKeyValues);
                }
            }
        }
예제 #3
0
        public virtual Sidecar CreateStoreGeneratedValues([NotNull] StateEntry stateEntry)
        {
            Check.NotNull(stateEntry, "stateEntry");

            return(_storeGeneratedValuesFactory.Create(stateEntry));
        }