protected override void Act() { var builder = new DomainModelBuilder(); builder.AddAggregate( new AggregateDefinition( new FullName("edfi", "Student"), new[] { new FullName("edfi", "Student") })); // Top-level builder.AddEntity( new EntityDefinition( "edfi", "Student", new[] { new EntityPropertyDefinition( "StudentUSI", new PropertyType(DbType.Int32, 0, 10, 0, false), "A unique number or alphanumeric code assigned to a student by a state education agency.", true, true), new EntityPropertyDefinition( "FirstName", new PropertyType(DbType.String, 75, 0, 0, false), "A name given to an individual at birth, baptism, or during another naming ceremony, or through legal change.", false, false), new EntityPropertyDefinition( "MiddleName", new PropertyType(DbType.String, 75, 0, 0, true), "A secondary name given to an individual at birth, baptism, or during another naming ceremony.", false, false), new EntityPropertyDefinition( "LastSurname", new PropertyType(DbType.String, 75, 0, 0, false), "The name borne in common by members of a family.", false, false) }, new[] { new EntityIdentifierDefinition( "PK_Student", new[] { "StudentUSI" }, true, false) }, isAbstract: true)); builder.AddEntity( new EntityDefinition( "sample", "StudentPet", new[] { new EntityPropertyDefinition("PetName", new PropertyType(DbType.String, 20, 0, 0, false), "", true, false), new EntityPropertyDefinition("IsFixed", new PropertyType(DbType.Boolean, 0, 0, 0, true), "", false, false), new EntityPropertyDefinition("CreateDate", new PropertyType(DbType.DateTime, 0, 0, 0, false), "", false, false) }, new[] { new EntityIdentifierDefinition( "PK_StudentPet", new[] { "StudentUSI", "PetName" }, true, false) }, false, "") ); builder.AddEntity( new EntityDefinition( "sample", "StudentPetPreference", new[] { new EntityPropertyDefinition("MinimumWeight", new PropertyType(DbType.Int32, 0, 10, 0, false), "", false, false), new EntityPropertyDefinition("MaximumWeight", new PropertyType(DbType.Int32, 0, 10, 0, false), "", false, false), new EntityPropertyDefinition("CreateDate", new PropertyType(DbType.DateTime, 0, 0, 0, false), "", false, false) }, new[] { new EntityIdentifierDefinition( "PK_StudentPetPreference", new[] { "StudentUSI" }, true, false) }, false, "") ); builder.AddAssociation( new AssociationDefinition( new FullName("sample", "FK_StudentPet_Student_StudentUSI"), Cardinality.OneToZeroOrMore, new FullName("edfi", "Student"), new[] { new EntityPropertyDefinition( "StudentUSI", new PropertyType(DbType.Int32, 0, 10, 0, false), "A unique number or alphanumeric code assigned to a student by a state education agency.", true, true) }, new FullName("sample", "StudentPet"), new[] { new EntityPropertyDefinition("StudentUSI", new PropertyType(DbType.Int32, 0, 10, 0, false), "", true, false) }, true, true) ); builder.AddAssociation( new AssociationDefinition( new FullName("sample", "FK_StudentPetPreference_Student_StudentUSI"), Cardinality.OneToOne, new FullName("edfi", "Student"), new[] { new EntityPropertyDefinition( "StudentUSI", new PropertyType(DbType.Int32, 0, 10, 0, false), "A unique number or alphanumeric code assigned to a student by a state education agency.", true, true) }, new FullName("sample", "StudentPetPreference"), new[] { new EntityPropertyDefinition("StudentUSI", new PropertyType(DbType.Int32, 0, 10, 0, false), "", true, true) }, true, true) ); builder.AddAggregateExtension( new AggregateExtensionDefinition( new FullName("edfi", "Student"), new[] { new FullName("sample", "StudentPet"), new FullName("sample", "StudentPetPreference") }) ); builder.AddSchema(new SchemaDefinition("Ed-Fi", "edfi")); builder.AddSchema(new SchemaDefinition("Sample", "sample")); _domainModel = builder.Build(); _resourceModel = new ResourceModel(_domainModel); }