protected override void DefineSchema(ISchema metaModel)
            {
                NamedElement         = new SchemaEntity(metaModel, "NamedElement");
                Library              = new SchemaEntity(metaModel, "Library", NamedElement);
                Book                 = new SchemaEntity(metaModel, "Book");
                Member               = new SchemaEntity(metaModel, "Member", NamedElement);
                Loan                 = new SchemaEntity(metaModel, "Loan");
                LoanReferencesBook   = new SchemaRelationship("LoanReferencesBook", Loan, Book, Cardinality.ManyToOne, false, null, "Book");
                LibraryHasBooks      = new SchemaRelationship("LibraryHasBooks", Library, Book, Cardinality.OneToMany, true, null, "Books");
                LibraryHasMembers    = new SchemaRelationship("LibraryHasMembers", Library, Member, Cardinality.OneToMany, true, null, "Members");
                LibraryHasLoans      = new SchemaRelationship("LibraryHasLoans", Library, Loan, Cardinality.OneToMany, true, null, "Loans");
                LoanReferencesMember = new SchemaRelationship("LoanReferencesMember", Loan, Member, Cardinality.ManyToOne, false, null, "Member");

                NamedElement.DefineProperty <string>("Name");
                Book.DefineProperty <string>("Title");
                Book.DefineProperty <int>("Copies");
            }
예제 #2
0
        protected override void DefineSchema(ISchema schema)
        {
            ISchemaEntity customer = new SchemaEntity <Customer>(schema);

            customer.DefineProperty <string>("Name");
            ISchemaEntity product = new SchemaEntity <Product>(schema);

            product.DefineProperty <string>("Name");
            ISchemaRelationship rel = new SchemaRelationship("CustomerReferencesProducts", customer, product, Cardinality.ManyToMany);
        }