コード例 #1
0
ファイル: EntityFluent.cs プロジェクト: Anupam-/Ilaro.Admin
 /// <summary>
 /// Add entity to Ilaro.Admin
 /// </summary>
 public static Entity <TEntity> Add()
 {
     return(new Entity <TEntity>
     {
         _entity = AdminInitialise.AddEntity <TEntity>()
     });
 }
コード例 #2
0
        protected void Application_Start()
        {
            AdminInitialise.RegisterResourceRoutes(RouteTable.Routes);
            AdminInitialise.RegisterRoutes(RouteTable.Routes, prefix: "Admin");

            Entity <Customer> .Add();           //.ConfigureProperty(PropertyOf<Customer>.Configure(c => c.CompanyName).SetDisplayTemplate(Templates.Display.Html).SetEditorTemplate(Templates.Editor.Html))

            //.AddPropertiesGroup("Main section", c => c.CompanyName)
            //.AddPropertiesGroup("Contact section", true, c => c.ContactName, c => c.ContactTitle)
            //.SetKey(x => x.CustomerID)
            //.SetTableName("Customers")
            //.SetColumns(x => x.Address, x => x.City, x => x.Country, x => x.CustomerID, x => x.CompanyName)
            //.SetSearchProperties(x => x.City)
            //.AddPropertiesGroup("Super", x => x.Address, x => x.City)
            //.SetDisplayFormat("")
            //.ConfigureProperty(PropertyOf<Customer>.Configure(x => x.CompanyName));

            Entity <Employee> .Add().SetColumns(x => x.EmployeeID, x => x.LastName, x => x.FirstName, x => x.Title, x => x.BirthDate,
                                                x => x.HireDate, x => x.Address, x => x.City, x => x.Region, x => x.PostalCode, x => x.PhotoPath, x => x.Photo)
            .ConfigureProperty(PropertyOf <Employee> .Configure(x => x.Photo)
                               .SetImageOptions(NameCreation.Timestamp, FileUploadDefault.MaxFileSize, false, FileUploadDefault.ImageExtensions)
                               .SetImageSettings("", 100, 100, true, true))
            .ConfigureProperty(PropertyOf <Employee> .Configure(x => x.PhotoPath)
                               .SetImageOptions(NameCreation.Timestamp, FileUploadDefault.MaxFileSize, false, FileUploadDefault.ImageExtensions)
                               .SetImageSettings("content/employee/min", 100, 100, true, false)
                               .SetImageSettings("content/employee/big", 500, 500, false, true));

            Entity <Order> .Add();

            Entity <OrderDetail> .Add().SetTableName("Order Details");

            Entity <Product> .Add();

            Entity <Category> .Add();

            Entity <EmployeeTerritory> .Add();

            Entity <Region> .Add();

            Entity <Shipper> .Add();

            Entity <Supplier> .Add();

            Entity <Territory> .Add();

            Entity <EntityChange> .Add();

            // If you want anonymous access to Ilaro.Admin, skip this line
            // off course you can set Roles and Users for AuthorizeAttribute
            AdminInitialise.Authorize = new System.Web.Mvc.AuthorizeAttribute();

            // If you have only one connection string there is no need to specify it
            AdminInitialise.Initialise("NorthwindEntities");

            AreaRegistration.RegisterAllAreas();
            RegisterRoutes(RouteTable.Routes);
        }
コード例 #3
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            AdminInitialise.RegisterRoutes(RouteTable.Routes, prefix: "Admin");
            AdminInitialise.RegisterResourceRoutes(RouteTable.Routes);
        }
コード例 #4
0
        public void simple_types_mentioned_in_foreign_attribute_of_other_property__are_foreign_key(string propertyName)
        {
            AdminInitialise.AddEntity <TestEntity>();
            AdminInitialise.SetForeignKeysReferences();

            var entity = AdminInitialise.EntitiesTypes.FirstOrDefault();

            Assert.NotNull(entity);

            var property = entity[propertyName];

            Assert.NotNull(property);
            Assert.True(property.IsForeignKey);
        }
コード例 #5
0
        public void SetForeigns_ForeignAttribute_SetForeignKeysReferences()
        {
            AdminInitialise.AddEntity <TestEntity>();
            AdminInitialise.SetForeignKeysReferences();

            var testEntity = AdminInitialise.EntitiesTypes.FirstOrDefault();
            var property   = testEntity.Properties.FirstOrDefault(x => x.Name == "Parent");

            Assert.IsTrue(property.IsForeignKey);

            property = testEntity.Properties.FirstOrDefault(x => x.Name == "ParentId");
            Assert.IsFalse(property.IsForeignKey);

            property = testEntity.Properties.FirstOrDefault(x => x.Name == "Child");
            Assert.IsTrue(property.IsForeignKey);

            property = testEntity.Properties.FirstOrDefault(x => x.Name == "ChildId");
            Assert.IsTrue(property.IsForeignKey);

            property = testEntity.Properties.FirstOrDefault(x => x.Name == "RoleId");
            Assert.IsTrue(property.IsForeignKey);
        }