private Key CreateKey(EntityType entityType, int startingPropertyIndex = -1, int propertyCount = 1)
 {
     if (startingPropertyIndex == -1)
     {
         startingPropertyIndex = entityType.PropertyCount - 1;
     }
     var keyProperties = new Property[propertyCount];
     for (var i = 0; i < propertyCount; i++)
     {
         var property = entityType.GetOrAddProperty("P" + (startingPropertyIndex + i));
         property.ClrType = typeof(int?);
         property.IsShadowProperty = false;
         keyProperties[i] = property;
         keyProperties[i].RequiresValueGenerator = true;
     }
     return entityType.AddKey(keyProperties);
 }
        public RelationalPropertyBuilder([NotNull] Property property)
        {
            Check.NotNull(property, nameof(property));

            _property = property;
        }
 private Key CreateKey(EntityType entityType, int startingPropertyIndex = -1, int propertyCount = 1)
 {
     if (startingPropertyIndex == -1)
     {
         startingPropertyIndex = entityType.PropertyCount;
     }
     var keyProperties = new Property[propertyCount];
     for (int i = 0; i < propertyCount; i++)
     {
         keyProperties[i] = entityType.GetOrAddProperty("P" + (startingPropertyIndex + i), typeof(int?));
         keyProperties[i].GenerateValueOnAdd = true;
     }
     return entityType.AddKey(keyProperties);
 }
Esempio n. 4
0
 private bool RequiresOriginalValue(Property addedOrRemovedProperty)
 {
     return(_useEagerSnapshots ||
            ((IProperty)addedOrRemovedProperty).IsConcurrencyToken ||
            ForeignKeys.SelectMany(k => k.Properties).Contains(addedOrRemovedProperty));
 }
        public SqlServerPropertyBuilder([NotNull] Property property)
        {
            Check.NotNull(property, nameof(property));

            _property = property;
        }
Esempio n. 6
0
 public virtual Index FindIndex([NotNull] Property property)
 {
     return(FindIndex(new[] { property }));
 }
Esempio n. 7
0
 public virtual Index GetIndex([NotNull] Property property)
 {
     return(GetIndex(new[] { property }));
 }
Esempio n. 8
0
 public virtual ForeignKey GetForeignKey([NotNull] Property property)
 {
     return(GetForeignKey(new[] { property }));
 }
Esempio n. 9
0
 public virtual ForeignKey GetOrAddForeignKey(
     [NotNull] Property property, [NotNull] Key principalKey)
 {
     return(GetOrAddForeignKey(new[] { property }, principalKey));
 }
Esempio n. 10
0
 public virtual Key FindKey([NotNull] Property property)
 {
     return(FindKey(new[] { property }));
 }
Esempio n. 11
0
 public virtual Key GetOrAddKey([NotNull] Property property)
 {
     return(GetOrAddKey(new[] { property }));
 }
Esempio n. 12
0
 public virtual Key GetOrSetPrimaryKey([CanBeNull] Property property)
 {
     return(GetOrSetPrimaryKey(property == null ? null : new[] { property }));
 }