Пример #1
0
 public static EntitySiteMappingConfiguration.MapPart Map <T> (
     this EntitySiteMappingConfiguration conf) where T : ModelBase
 {
     if (conf == null)
     {
         throw new ArgumentNullException("conf");
     }
     return(conf.Map(typeof(T)));
 }
        protected virtual void Application_Start(Object sender, EventArgs e)
        {
            var connectionString = ConfigurationManager.ConnectionStrings ["AspSQLProvider"];

            MvcStoreApplication.InitDb(connectionString.ConnectionString);

            var root = SiteMap.RootNode;

            EntitySiteMappingConfiguration.Configure()
            .Map <Category> ().To(root.Find("Category"))
            .Map <Product> ().To(root.Find("Product"))
            .Map <Order> ().To(root.Find("Order"))
            .Map <Cart> ().To(root.Find("Cart"));
        }
Пример #3
0
 public MapPart(EntitySiteMappingConfiguration conf, Type entity)
 {
     if (conf == null)
     {
         throw new ArgumentNullException("conf");
     }
     if (entity == null)
     {
         throw new ArgumentNullException("entity");
     }
     if (!typeof(ModelBase).IsAssignableFrom(entity))
     {
         throw new ArgumentException("entity must be derived from ModeBase.");
     }
     this.conf   = conf;
     this.entity = entity;
 }