/// <summary> /// Moves a foreign key constraint from oldTable to newTable and updates column references /// </summary> private static void MoveForeignKeyConstraint( EntityType fromTable, EntityType toTable, ForeignKeyBuilder fk) { DebugCheck.NotNull(fromTable); DebugCheck.NotNull(toTable); DebugCheck.NotNull(fk); fromTable.RemoveForeignKey(fk); // Only move it to the new table if the destination is not the principal table or if all dependent columns are not FKs // Otherwise you end up with an FK from the PKs to the PKs of the same table if (fk.PrincipalTable != toTable || !fk.DependentColumns.All(c => c.IsPrimaryKeyColumn)) { // Make sure all the dependent columns refer to columns in the newTable var oldColumns = fk.DependentColumns.ToArray(); var dependentColumns = GetDependentColumns(oldColumns, toTable.Properties); if (!ContainsEquivalentForeignKey(toTable, fk.PrincipalTable, dependentColumns)) { toTable.AddForeignKey(fk); fk.DependentColumns = dependentColumns; } } }
internal override void Configure( AssociationSetMapping associationSetMapping, EdmModel database, PropertyInfo navigationProperty) { List <ScalarPropertyMapping> propertyMappings = associationSetMapping.SourceEndMapping.PropertyMappings.ToList <ScalarPropertyMapping>(); if (this._tableName != null) { EntityType targetTable = database.EntityTypes.Select(t => new { t = t, n = t.GetTableName() }).Where(_param1 => { if (_param1.n != null) { return(_param1.n.Equals(this._tableName)); } return(false); }).Select(_param0 => _param0.t).SingleOrDefault <EntityType>() ?? database.GetEntitySets().Where <EntitySet>((Func <EntitySet, bool>)(es => string.Equals(es.Table, this._tableName.Name, StringComparison.Ordinal))).Select <EntitySet, EntityType>((Func <EntitySet, EntityType>)(es => es.ElementType)).SingleOrDefault <EntityType>(); if (targetTable == null) { throw Error.TableNotFound((object)this._tableName); } EntityType sourceTable = associationSetMapping.Table; if (sourceTable != targetTable) { ForeignKeyBuilder foreignKeyBuilder = sourceTable.ForeignKeyBuilders.Single <ForeignKeyBuilder>((Func <ForeignKeyBuilder, bool>)(fk => fk.DependentColumns.SequenceEqual <EdmProperty>(propertyMappings.Select <ScalarPropertyMapping, EdmProperty>((Func <ScalarPropertyMapping, EdmProperty>)(pm => pm.Column))))); sourceTable.RemoveForeignKey(foreignKeyBuilder); targetTable.AddForeignKey(foreignKeyBuilder); foreignKeyBuilder.DependentColumns.Each <EdmProperty>((Action <EdmProperty>)(c => { bool primaryKeyColumn = c.IsPrimaryKeyColumn; sourceTable.RemoveMember((EdmMember)c); targetTable.AddMember((EdmMember)c); if (!primaryKeyColumn) { return; } targetTable.AddKeyMember((EdmMember)c); })); associationSetMapping.StoreEntitySet = database.GetEntitySet(targetTable); } } if (this._keyColumnNames.Count > 0 && this._keyColumnNames.Count != propertyMappings.Count <ScalarPropertyMapping>()) { throw Error.IncorrectColumnCount((object)string.Join(", ", (IEnumerable <string>) this._keyColumnNames)); } this._keyColumnNames.Each <string>((Action <string, int>)((n, i) => propertyMappings[i].Column.Name = n)); foreach (KeyValuePair <Tuple <string, string>, object> annotation in (IEnumerable <KeyValuePair <Tuple <string, string>, object> >) this._annotations) { int index = this._keyColumnNames.IndexOf(annotation.Key.Item1); if (index == -1) { throw new InvalidOperationException(Strings.BadKeyNameForAnnotation((object)annotation.Key.Item1, (object)annotation.Key.Item2)); } propertyMappings[index].Column.AddAnnotation("http://schemas.microsoft.com/ado/2013/11/edm/customannotation:" + annotation.Key.Item2, annotation.Value); } }
private static void CopyForeignKeyConstraint(EdmModel database, EntityType toTable, ForeignKeyBuilder fk, Func <EdmProperty, EdmProperty> selector = null) { DebugCheck.NotNull(toTable); DebugCheck.NotNull(fk); var newFk = new ForeignKeyBuilder( database, database.EntityTypes.SelectMany(t => t.ForeignKeyBuilders).UniquifyName(fk.Name)) { PrincipalTable = fk.PrincipalTable, DeleteAction = fk.DeleteAction }; newFk.SetPreferredName(fk.Name); var dependentColumns = GetDependentColumns( selector != null ? fk.DependentColumns.Select(selector) : fk.DependentColumns, toTable.Properties); if (!ContainsEquivalentForeignKey(toTable, newFk.PrincipalTable, dependentColumns)) { toTable.AddForeignKey(newFk); newFk.DependentColumns = dependentColumns; } }
public static IColumnBuilder References(this IColumnBuilder builder, Action<IColumnForeignKeyBuilder> foreignKey) { var fkeyBuilder = new ForeignKeyBuilder(); foreignKey(fkeyBuilder); return builder.WithConstraint(fkeyBuilder.Build()); }
private static void GenerateForeignKeyAssociationType( AssociationType associationType, DbDatabaseMapping databaseMapping) { DebugCheck.NotNull(associationType); DebugCheck.NotNull(databaseMapping); Debug.Assert(associationType.Constraint != null); var dependentEnd = associationType.Constraint.DependentEnd; var principalEnd = associationType.GetOtherEnd(dependentEnd); var principalEntityTypeMapping = GetEntityTypeMappingInHierarchy(databaseMapping, principalEnd.GetEntityType()); var dependentEntityTypeMapping = GetEntityTypeMappingInHierarchy(databaseMapping, dependentEnd.GetEntityType()); var foreignKeyConstraint = new ForeignKeyBuilder(databaseMapping.Database, associationType.Name) { PrincipalTable = principalEntityTypeMapping.MappingFragments.Single().Table, DeleteAction = principalEnd.DeleteBehavior != OperationAction.None ? principalEnd.DeleteBehavior : OperationAction.None }; dependentEntityTypeMapping .MappingFragments .Single() .Table .AddForeignKey(foreignKeyConstraint); foreignKeyConstraint.DependentColumns = associationType.Constraint.ToProperties.Select( dependentProperty => dependentEntityTypeMapping.GetPropertyMapping(dependentProperty).ColumnProperty); foreignKeyConstraint.SetAssociationType(associationType); }
private static void ConfigureDependentKeys( DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest) { IList <EntityType> entityTypeList = databaseMapping.Database.EntityTypes as IList <EntityType> ?? (IList <EntityType>)databaseMapping.Database.EntityTypes.ToList <EntityType>(); for (int index1 = 0; index1 < entityTypeList.Count; ++index1) { EntityType entityType = entityTypeList[index1]; IList <ForeignKeyBuilder> foreignKeyBuilderList = entityType.ForeignKeyBuilders as IList <ForeignKeyBuilder> ?? (IList <ForeignKeyBuilder>)entityType.ForeignKeyBuilders.ToList <ForeignKeyBuilder>(); for (int index2 = 0; index2 < foreignKeyBuilderList.Count; ++index2) { ForeignKeyBuilder foreignKeyBuilder = foreignKeyBuilderList[index2]; IEnumerable <EdmProperty> dependentColumns = foreignKeyBuilder.DependentColumns; IList <EdmProperty> edmPropertyList = dependentColumns as IList <EdmProperty> ?? (IList <EdmProperty>)dependentColumns.ToList <EdmProperty>(); for (int index3 = 0; index3 < edmPropertyList.Count; ++index3) { EdmProperty edmProperty = edmPropertyList[index3]; System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration configuration = edmProperty.GetConfiguration() as System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration; if (configuration == null || configuration.ColumnType == null) { EdmProperty other = foreignKeyBuilder.PrincipalTable.KeyProperties.ElementAt <EdmProperty>(index3); edmProperty.PrimitiveType = providerManifest.GetStoreTypeFromName(other.TypeName); edmProperty.CopyFrom(other); } } } } }
public static void SetAssociationType( this ForeignKeyBuilder fk, AssociationType associationType) { DebugCheck.NotNull(fk); DebugCheck.NotNull(associationType); fk.Annotations.SetAnnotation(AssociationType, associationType); }
public static IColumnBuilder References(this IColumnBuilder builder, Action <IColumnForeignKeyBuilder> foreignKey) { var fkeyBuilder = new ForeignKeyBuilder(); foreignKey(fkeyBuilder); return(builder.WithConstraint(fkeyBuilder.Build())); }
public static void SetAssociationType( this ForeignKeyBuilder fk, AssociationType associationType) { DebugCheck.NotNull(fk); DebugCheck.NotNull(associationType); fk.GetMetadataProperties().SetAnnotation(AssociationType, associationType); }
public static bool GetIsTypeConstraint(this ForeignKeyBuilder fk) { object annotation = fk.Annotations.GetAnnotation("IsTypeConstraint"); if (annotation != null) { return((bool)annotation); } return(false); }
public static bool GetIsTypeConstraint(this ForeignKeyBuilder fk) { DebugCheck.NotNull(fk); var result = fk.Annotations.GetAnnotation(IsTypeConstraint); if (result != null) { return((bool)result); } return(false); }
private void GenerateIndependentForeignKeyConstraint( DbDatabaseMapping databaseMapping, EntityType principalEntityType, EntityType dependentEntityType, EntityType dependentTable, StorageAssociationSetMapping associationSetMapping, StorageEndPropertyMapping associationEndMapping, string name, AssociationEndMember principalEnd, bool isPrimaryKeyColumn = false) { DebugCheck.NotNull(databaseMapping); DebugCheck.NotNull(principalEntityType); DebugCheck.NotNull(dependentTable); DebugCheck.NotNull(associationEndMapping); DebugCheck.NotEmpty(name); var principalTable = GetEntityTypeMappingInHierarchy(databaseMapping, principalEntityType) .MappingFragments .Single() .Table; var foreignKeyConstraint = new ForeignKeyBuilder(databaseMapping.Database, name) { PrincipalTable = principalTable, DeleteAction = associationEndMapping.EndMember.DeleteBehavior != OperationAction.None ? associationEndMapping.EndMember.DeleteBehavior : OperationAction.None }; var principalNavigationProperty = databaseMapping.Model.GetEntityTypes() .SelectMany(e => e.DeclaredNavigationProperties) .SingleOrDefault(n => n.ResultEnd == principalEnd); dependentTable.AddForeignKey(foreignKeyConstraint); foreignKeyConstraint.DependentColumns = GenerateIndependentForeignKeyColumns( principalEntityType, dependentEntityType, associationSetMapping, associationEndMapping, dependentTable, isPrimaryKeyColumn, principalNavigationProperty); }
public static void RemoveAllForeignKeyConstraintsForColumn( EntityType table, EdmProperty column, DbDatabaseMapping databaseMapping) { ((IEnumerable <ForeignKeyBuilder>)table.ForeignKeyBuilders.Where <ForeignKeyBuilder>((Func <ForeignKeyBuilder, bool>)(fk => fk.DependentColumns.Contains <EdmProperty>(column))).ToArray <ForeignKeyBuilder>()).Each <ForeignKeyBuilder>((Action <ForeignKeyBuilder>)(fk => { table.RemoveForeignKey(fk); ForeignKeyBuilder fk1 = databaseMapping.Database.EntityTypes.SelectMany <EntityType, ForeignKeyBuilder>((Func <EntityType, IEnumerable <ForeignKeyBuilder> >)(t => t.ForeignKeyBuilders)).SingleOrDefault <ForeignKeyBuilder>((Func <ForeignKeyBuilder, bool>)(fk2 => object.Equals((object)fk2.GetPreferredName(), (object)fk.Name))); if (fk1 == null) { return; } fk1.Name = fk1.GetPreferredName(); })); }
private static void GenerateForeignKeyAssociationType( AssociationType associationType, DbDatabaseMapping databaseMapping) { AssociationEndMember dependentEnd = associationType.Constraint.DependentEnd; AssociationEndMember otherEnd = associationType.GetOtherEnd(dependentEnd); EntityTypeMapping mappingInHierarchy = StructuralTypeMappingGenerator.GetEntityTypeMappingInHierarchy(databaseMapping, otherEnd.GetEntityType()); EntityTypeMapping dependentEntityTypeMapping = StructuralTypeMappingGenerator.GetEntityTypeMappingInHierarchy(databaseMapping, dependentEnd.GetEntityType()); ForeignKeyBuilder foreignKeyBuilder = new ForeignKeyBuilder(databaseMapping.Database, associationType.Name) { PrincipalTable = mappingInHierarchy.MappingFragments.Single <MappingFragment>().Table, DeleteAction = otherEnd.DeleteBehavior != OperationAction.None ? otherEnd.DeleteBehavior : OperationAction.None }; dependentEntityTypeMapping.MappingFragments.Single <MappingFragment>().Table.AddForeignKey(foreignKeyBuilder); foreignKeyBuilder.DependentColumns = associationType.Constraint.ToProperties.Select <EdmProperty, EdmProperty>((Func <EdmProperty, EdmProperty>)(dependentProperty => dependentEntityTypeMapping.GetPropertyMapping(dependentProperty).ColumnProperty)); foreignKeyBuilder.SetAssociationType(associationType); }
private static void MoveForeignKeyConstraint( EntityType fromTable, EntityType toTable, ForeignKeyBuilder fk) { fromTable.RemoveForeignKey(fk); if (fk.PrincipalTable == toTable && fk.DependentColumns.All <EdmProperty>((Func <EdmProperty, bool>)(c => c.IsPrimaryKeyColumn))) { return; } IList <EdmProperty> dependentColumns = ForeignKeyPrimitiveOperations.GetDependentColumns((IEnumerable <EdmProperty>)fk.DependentColumns.ToArray <EdmProperty>(), (IEnumerable <EdmProperty>)toTable.Properties); if (ForeignKeyPrimitiveOperations.ContainsEquivalentForeignKey(toTable, fk.PrincipalTable, (IEnumerable <EdmProperty>)dependentColumns)) { return; } toTable.AddForeignKey(fk); fk.DependentColumns = (IEnumerable <EdmProperty>)dependentColumns; }
public void Configure_should_split_key_constraint_when_to_table_configuration() { var database = new EdmModel().DbInitialize(); var sourceTable = database.AddTable("Source"); var principalTable = database.AddTable("P"); var fkColumn = new EdmProperty( "Fk", ProviderRegistry.Sql2008_ProviderManifest.GetStoreType( TypeUsage.Create(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)))); sourceTable.AddColumn(fkColumn); var foreignKeyConstraint = new ForeignKeyBuilder(database, "FK") { PrincipalTable = principalTable }; sourceTable.AddForeignKey(foreignKeyConstraint); foreignKeyConstraint.DependentColumns = new[] { fkColumn }; var targetTable = database.AddTable("Split"); var associationSetMapping = new StorageAssociationSetMapping( new AssociationSet("AS", new AssociationType()), database.GetEntitySet(sourceTable)).Initialize(); associationSetMapping.SourceEndMapping.AddProperty(new StorageScalarPropertyMapping(new EdmProperty("PK"), fkColumn)); var independentAssociationMappingConfiguration = new ForeignKeyAssociationMappingConfiguration(); independentAssociationMappingConfiguration.ToTable("Split"); independentAssociationMappingConfiguration.Configure(associationSetMapping, database, new MockPropertyInfo()); Assert.True(targetTable.Properties.Contains(fkColumn)); Assert.True(targetTable.ForeignKeyBuilders.Contains(foreignKeyConstraint)); Assert.False(sourceTable.Properties.Contains(fkColumn)); Assert.False(sourceTable.ForeignKeyBuilders.Contains(foreignKeyConstraint)); Assert.Same(targetTable, associationSetMapping.Table); }
public void Apply_should_introduce_cascade_delete_on_constraints() { var databaseMapping = new DbDatabaseMapping() .Initialize(new EdmModel().Initialize(), new EdmModel().Initialize()); var foreignKeyConstraint = new ForeignKeyBuilder(databaseMapping.Database, "FK") { PrincipalTable = new EntityType("P", XmlConstants.TargetNamespace_3, DataSpace.SSpace) }; Assert.Equal(OperationAction.None, foreignKeyConstraint.DeleteAction); var table = databaseMapping.Database.AddTable("T"); table.AddForeignKey(foreignKeyConstraint); var associationType = new AssociationType { SourceEnd = new AssociationEndMember("S", new EntityType()), TargetEnd = new AssociationEndMember("T", new EntityType()) }; associationType.SourceEnd.RelationshipMultiplicity = RelationshipMultiplicity.Many; associationType.TargetEnd.RelationshipMultiplicity = RelationshipMultiplicity.Many; var associationSetMapping = databaseMapping.AddAssociationSetMapping( new AssociationSet("AS", associationType), new EntitySet()); associationSetMapping.StoreEntitySet = databaseMapping.Database.GetEntitySet(table); ((IDbMappingConvention) new ManyToManyCascadeDeleteConvention()).Apply(databaseMapping); Assert.Equal(OperationAction.Cascade, foreignKeyConstraint.DeleteAction); }
private void GenerateIndependentForeignKeyConstraint( DbDatabaseMapping databaseMapping, EntityType principalEntityType, EntityType dependentEntityType, EntityType dependentTable, AssociationSetMapping associationSetMapping, EndPropertyMapping associationEndMapping, string name, AssociationEndMember principalEnd, bool isPrimaryKeyColumn = false) { EntityType table = StructuralTypeMappingGenerator.GetEntityTypeMappingInHierarchy(databaseMapping, principalEntityType).MappingFragments.Single <MappingFragment>().Table; ForeignKeyBuilder foreignKeyBuilder = new ForeignKeyBuilder(databaseMapping.Database, name) { PrincipalTable = table, DeleteAction = associationEndMapping.AssociationEnd.DeleteBehavior != OperationAction.None ? associationEndMapping.AssociationEnd.DeleteBehavior : OperationAction.None }; NavigationProperty principalNavigationProperty = databaseMapping.Model.EntityTypes.SelectMany <EntityType, NavigationProperty>((Func <EntityType, IEnumerable <NavigationProperty> >)(e => (IEnumerable <NavigationProperty>)e.DeclaredNavigationProperties)).SingleOrDefault <NavigationProperty>((Func <NavigationProperty, bool>)(n => n.ResultEnd == principalEnd)); dependentTable.AddForeignKey(foreignKeyBuilder); foreignKeyBuilder.DependentColumns = this.GenerateIndependentForeignKeyColumns(principalEntityType, dependentEntityType, associationSetMapping, associationEndMapping, dependentTable, isPrimaryKeyColumn, principalNavigationProperty); }
public static void AddTypeConstraint( EdmModel database, EntityType entityType, EntityType principalTable, EntityType dependentTable, bool isSplitting) { DebugCheck.NotNull(principalTable); DebugCheck.NotNull(dependentTable); DebugCheck.NotNull(entityType); var foreignKeyConstraintMetadata = new ForeignKeyBuilder( database, String.Format( CultureInfo.InvariantCulture, "{0}_TypeConstraint_From_{1}_To_{2}", entityType.Name, principalTable.Name, dependentTable.Name)) { PrincipalTable = principalTable }; dependentTable.AddForeignKey(foreignKeyConstraintMetadata); if (isSplitting) { foreignKeyConstraintMetadata.SetIsSplitConstraint(); } else { foreignKeyConstraintMetadata.SetIsTypeConstraint(); } foreignKeyConstraintMetadata.DependentColumns = dependentTable.Properties.Where(c => c.IsPrimaryKeyColumn); //If "DbStoreGeneratedPattern.Identity" was copied from the parent table, it should be removed dependentTable.Properties.Where(c => c.IsPrimaryKeyColumn).Each(c => c.RemoveStoreGeneratedIdentityPattern()); }
private static void CopyForeignKeyConstraint( EdmModel database, EntityType toTable, ForeignKeyBuilder fk, Func <EdmProperty, EdmProperty> selector = null) { ForeignKeyBuilder foreignKeyBuilder = new ForeignKeyBuilder(database, ((IEnumerable <INamedDataModelItem>)database.EntityTypes.SelectMany <EntityType, ForeignKeyBuilder>((Func <EntityType, IEnumerable <ForeignKeyBuilder> >)(t => t.ForeignKeyBuilders))).UniquifyName(fk.Name)) { PrincipalTable = fk.PrincipalTable, DeleteAction = fk.DeleteAction }; foreignKeyBuilder.SetPreferredName(fk.Name); IList <EdmProperty> dependentColumns = ForeignKeyPrimitiveOperations.GetDependentColumns(selector != null ? fk.DependentColumns.Select <EdmProperty, EdmProperty>(selector) : fk.DependentColumns, (IEnumerable <EdmProperty>)toTable.Properties); if (ForeignKeyPrimitiveOperations.ContainsEquivalentForeignKey(toTable, foreignKeyBuilder.PrincipalTable, (IEnumerable <EdmProperty>)dependentColumns)) { return; } toTable.AddForeignKey(foreignKeyBuilder); foreignKeyBuilder.DependentColumns = (IEnumerable <EdmProperty>)dependentColumns; }
private static AssociationSetMapping CreateIAMapping(EdmModel database, EntityType dependentTable) { var fkColumn = new EdmProperty( "FK", ProviderRegistry.Sql2008_ProviderManifest.GetStoreType( TypeUsage.Create(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)))); dependentTable.AddColumn(fkColumn); var foreignKeyConstraint = new ForeignKeyBuilder(database, "FK") { PrincipalTable = database.AddTable("P") }; dependentTable.AddForeignKey(foreignKeyConstraint); foreignKeyConstraint.DependentColumns = new[] { fkColumn }; var associationSetMapping = new AssociationSetMapping( new AssociationSet("AS", new AssociationType("A", XmlConstants.ModelNamespace_3, false, DataSpace.CSpace)), database.GetEntitySet(dependentTable)).Initialize(); associationSetMapping.SourceEndMapping.AddPropertyMapping(new ScalarPropertyMapping(new EdmProperty("PK"), fkColumn)); return(associationSetMapping); }
public static void AddTypeConstraint( EdmModel database, EntityType entityType, EntityType principalTable, EntityType dependentTable, bool isSplitting) { ForeignKeyBuilder foreignKeyBuilder = new ForeignKeyBuilder(database, string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}_TypeConstraint_From_{1}_To_{2}", (object)entityType.Name, (object)principalTable.Name, (object)dependentTable.Name)) { PrincipalTable = principalTable }; dependentTable.AddForeignKey(foreignKeyBuilder); if (isSplitting) { foreignKeyBuilder.SetIsSplitConstraint(); } else { foreignKeyBuilder.SetIsTypeConstraint(); } foreignKeyBuilder.DependentColumns = dependentTable.Properties.Where <EdmProperty>((Func <EdmProperty, bool>)(c => c.IsPrimaryKeyColumn)); dependentTable.Properties.Where <EdmProperty>((Func <EdmProperty, bool>)(c => c.IsPrimaryKeyColumn)).Each <EdmProperty>((Action <EdmProperty>)(c => c.RemoveStoreGeneratedIdentityPattern())); }
public static void SetPreferredName(this ForeignKeyBuilder fk, string name) { fk.GetMetadataProperties().SetAnnotation("PreferredName", (object)name); }
public static AssociationType GetAssociationType(this ForeignKeyBuilder fk) { DebugCheck.NotNull(fk); return(fk.Annotations.GetAnnotation(AssociationType) as AssociationType); }
public static void SetIsSplitConstraint(this ForeignKeyBuilder fk) { DebugCheck.NotNull(fk); fk.GetMetadataProperties().SetAnnotation(IsSplitConstraint, true); }
public static void SetIsSplitConstraint(this ForeignKeyBuilder fk) { fk.GetMetadataProperties().SetAnnotation("IsSplitConstraint", (object)true); }
public static void SetPreferredName(this ForeignKeyBuilder fk, string name) { DebugCheck.NotNull(fk); fk.GetMetadataProperties().SetAnnotation(PreferredNameAnnotation, name); }
public static string GetPreferredName(this ForeignKeyBuilder fk) { DebugCheck.NotNull(fk); return((string)fk.Annotations.GetAnnotation(PreferredNameAnnotation)); }
public static System.Data.Entity.Core.Metadata.Edm.AssociationType GetAssociationType( this ForeignKeyBuilder fk) { return(fk.Annotations.GetAnnotation("AssociationType") as System.Data.Entity.Core.Metadata.Edm.AssociationType); }
public static void SetAssociationType( this ForeignKeyBuilder fk, System.Data.Entity.Core.Metadata.Edm.AssociationType associationType) { fk.GetMetadataProperties().SetAnnotation("AssociationType", (object)associationType); }
public static void SetIsSplitConstraint(this ForeignKeyBuilder fk) { DebugCheck.NotNull(fk); fk.Annotations.SetAnnotation(IsSplitConstraint, true); }