public static void RegisterEntitySchema(IEntitySchemaContainer container) { container.Register <City>(EntitySchema.Create <City>() .IsGenericEntity() .HasCatalogInfo() .HasReference <State>(nameof(City.StateId)) .HasReference <Country>(nameof(City.CountryId)) .Build()); container.Register <State>(EntitySchema.Create <State>() .IsGenericEntity() .HasCatalogInfo() .HasReference <Country>(nameof(State.CountryId)) .Build()); container.Register <Country>(EntitySchema.Create <Country>() .IsGenericEntity() .HasCatalogInfo() .Build()); }
public static List <EntitySchema> RegisterEntitySchema() { return(new List <EntitySchema> { EntitySchema.Create <AccountType>() .IsGenericEntity() .HasCatalogInfo() .HasSearch(nameof(AccountType.Name)) .HasReference <AccountType>(nameof(AccountType.ParentId)) .Build(), EntitySchema.Create <Ledger>() .HasCatalogInfo(nameof(Ledger.Id), nameof(Ledger.AccountName)) .HasSearch(nameof(Ledger.AccountName)) .HasReference <LedgerGroup>(nameof(Ledger.LedgerGroupId)) .HasReference <City>(nameof(Ledger.CityId)) .HasReference <State>(nameof(Ledger.StateId)) .HasReference <Country>(nameof(Ledger.CountryId)) .Build(), EntitySchema.Create <LedgerGroup>() .IsGenericEntity() .HasCatalogInfo() .HasSearch(nameof(LedgerGroup.Name)) .HasReference <AccountType>(nameof(LedgerGroup.AccountTypeId)) .HasReference <LedgerGroup>(nameof(LedgerGroup.ParentId)) .Build(), EntitySchema.Create <MeasurementUnit>() .IsGenericEntity() .HasCatalogInfo() .HasSearch(nameof(MeasurementUnit.Name)) .Build(), EntitySchema.Create <ProductCategory>() .IsGenericEntity() .HasCatalogInfo() .HasSearch(nameof(ProductCategory.Name)) .Build(), EntitySchema.Create <ProductSubCategory>() .IsGenericEntity() .HasCatalogInfo() .HasSearch(nameof(ProductSubCategory.Name)) .HasReference <ProductCategory>(nameof(ProductSubCategory.CategoryId)) .Build(), EntitySchema.Create <Product>() .IsGenericEntity() .HasCatalogInfo() .HasSearch(nameof(Product.Name)) .HasReference <ProductCategory>(nameof(Product.CategoryId)) .HasReference <ProductSubCategory>(nameof(Product.SubCategoryId)) .HasReference <Ledger>(nameof(Product.SaleAccountId)) .HasReference <Ledger>(nameof(Product.PurchaseAccountId)) .HasReference <MeasurementUnit>(nameof(Product.MeasurementUnitId)) .Build(), EntitySchema.Create <TaxCategory>() .IsGenericEntity() .HasCatalogInfo() .HasSearch(nameof(TaxCategory.Name)) .HasReference <TaxCategory>(nameof(TaxCategory.CessId)) .Build(), }); }