public void Can_get_list_of_declared_members() { var entityType = new EntityType(); Assert.Empty(entityType.DeclaredMembers); var property1 = new NavigationProperty("N", TypeUsage.Create(new EntityType())); var property2 = EdmProperty.Primitive("P", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)); entityType.AddMember(property1); entityType.AddMember(property2); Assert.Equal(2, entityType.DeclaredMembers.Count); entityType.RemoveMember(property1); entityType.RemoveMember(property2); var baseType = new EntityType(); baseType.AddMember(property1); baseType.AddMember(property2); entityType.BaseType = baseType; Assert.Empty(entityType.DeclaredMembers); Assert.Equal(2, entityType.Members.Count); }
public void Can_get_list_of_key_properties() { var entityType = new EntityType("E", "N", DataSpace.CSpace); Assert.Empty(entityType.KeyProperties); var property = EdmProperty.CreatePrimitive("P", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)); entityType.AddKeyMember(property); Assert.Equal(1, entityType.KeyProperties.Count); Assert.Equal(1, entityType.KeyProperties.Where(key => entityType.DeclaredMembers.Contains(key)).Count()); entityType.RemoveMember(property); var baseType = new EntityType("E", "N", DataSpace.CSpace); baseType.AddKeyMember(property); entityType.BaseType = baseType; Assert.Equal(1, entityType.KeyProperties.Count); Assert.Empty(entityType.KeyProperties.Where(key => entityType.DeclaredMembers.Contains(key))); Assert.Equal(1, entityType.KeyMembers.Count); }
public static EdmProperty RemoveColumn(EntityType table, EdmProperty column) { DebugCheck.NotNull(table); DebugCheck.NotNull(column); if (!column.IsPrimaryKeyColumn) { table.RemoveMember(column); } return column; }
public void Can_remove_member() { var entityType = new EntityType("E", "N", DataSpace.CSpace); Assert.Empty(entityType.Members); var property = EdmProperty.CreatePrimitive("P", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)); entityType.AddMember(property); Assert.Equal(1, entityType.Members.Count); entityType.RemoveMember(property); Assert.Empty(entityType.Members); }
public void Can_remove_member() { var entityType = new EntityType("E", "N", DataSpace.CSpace); Assert.Empty(entityType.Members); var property = EdmProperty.Primitive("P", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)); entityType.AddMember(property); Assert.Equal(1, entityType.Members.Count); entityType.RemoveMember(property); Assert.Empty(entityType.Members); }
public void Can_remove_member() { var entityType = new EntityType(); Assert.Empty(entityType.Members); var property = EdmProperty.Primitive("P", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)); entityType.AddKeyMember(property); Assert.Equal(1, entityType.KeyMembers.Count); Assert.Equal(1, entityType.Members.Count); entityType.RemoveMember(property); Assert.Empty(entityType.KeyMembers); Assert.Empty(entityType.Members); }
public void Can_get_list_of_declared_properties() { var entityType = new EntityType("E", "N", DataSpace.CSpace); Assert.Empty(entityType.DeclaredProperties); var property = EdmProperty.Primitive("P", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)); entityType.AddMember(property); Assert.Equal(1, entityType.DeclaredProperties.Count); entityType.RemoveMember(property); var baseType = new EntityType("E", "N", DataSpace.CSpace); baseType.AddMember(property); entityType.BaseType = baseType; Assert.Empty(entityType.DeclaredProperties); Assert.Equal(1, entityType.Members.Count); }
public void Can_get_list_of_declared_navigation_properties() { var entityType = new EntityType("E", "N", DataSpace.CSpace); Assert.Empty(entityType.DeclaredNavigationProperties); var property = new NavigationProperty("N", TypeUsage.Create(new EntityType("E", "N", DataSpace.CSpace))); entityType.AddMember(property); Assert.Equal(1, entityType.DeclaredNavigationProperties.Count); entityType.RemoveMember(property); var baseType = new EntityType("E", "N", DataSpace.CSpace); baseType.AddMember(property); entityType.BaseType = baseType; Assert.Empty(entityType.DeclaredNavigationProperties); Assert.Equal(1, entityType.Members.Count); }
public void Can_get_list_of_declared_properties() { var entityType = new EntityType(); Assert.Empty(entityType.DeclaredProperties); var property = EdmProperty.Primitive("P", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)); entityType.AddMember(property); Assert.Equal(1, entityType.DeclaredProperties.Count); entityType.RemoveMember(property); var baseType = new EntityType(); baseType.AddMember(property); entityType.BaseType = baseType; Assert.Empty(entityType.DeclaredProperties); Assert.Equal(1, entityType.Members.Count); }
public void Can_get_list_of_declared_navigation_properties() { var entityType = new EntityType(); Assert.Empty(entityType.DeclaredNavigationProperties); var property = new NavigationProperty("N", TypeUsage.Create(new EntityType())); entityType.AddMember(property); Assert.Equal(1, entityType.DeclaredNavigationProperties.Count); entityType.RemoveMember(property); var baseType = new EntityType(); baseType.AddMember(property); entityType.BaseType = baseType; Assert.Empty(entityType.DeclaredNavigationProperties); Assert.Equal(1, entityType.Members.Count); }
public void Can_get_list_of_key_properties() { var entityType = new EntityType("E", "N", DataSpace.CSpace); Assert.Empty(entityType.KeyProperties); var property = EdmProperty.CreatePrimitive("P", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)); entityType.AddKeyMember(property); Assert.Equal(1, entityType.KeyProperties.Count); Assert.Equal(1, entityType.KeyProperties.Where(key => entityType.DeclaredMembers.Contains(key)).Count()); entityType.RemoveMember(property); var baseType = new EntityType("E", "N", DataSpace.CSpace); baseType.AddKeyMember(property); entityType.BaseType = baseType; Assert.Equal(1, entityType.KeyProperties.Count); Assert.Empty(entityType.KeyProperties.Where(key => entityType.DeclaredMembers.Contains(key))); Assert.Equal(1, entityType.KeyMembers.Count); }
public void Can_get_list_of_declared_members() { var entityType = new EntityType("E", "N", DataSpace.CSpace); Assert.Empty(entityType.DeclaredMembers); var property1 = new NavigationProperty("N", TypeUsage.Create(new EntityType("E", "N", DataSpace.CSpace))); var property2 = EdmProperty.Primitive("P", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)); entityType.AddMember(property1); entityType.AddMember(property2); Assert.Equal(2, entityType.DeclaredMembers.Count); entityType.RemoveMember(property1); entityType.RemoveMember(property2); var baseType = new EntityType("E", "N", DataSpace.CSpace); baseType.AddMember(property1); baseType.AddMember(property2); entityType.BaseType = baseType; Assert.Empty(entityType.DeclaredMembers); Assert.Equal(2, entityType.Members.Count); }