protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes, Assembly.GetExecutingAssembly()); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMappingConfig.ConfigureAutoMapping(); IocContainer.SetUp(Assembly.GetExecutingAssembly().GetName().Name); }
public static void Run() { Configuration cfg = null; ISessionFactory factory = null; try { #region NHibernate initialize var mapCfg = new AutoMappingConfig(); /* * When Automap is being used system does not know which namespaces to investigate under certain assembly. * This configuration helps FluentNHibernate to seach proper namespaces or else. * This can be modified accordign to needs. * * Always prefer writing you own mapping files. */ factory = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008 .ConnectionString(c => c .FromConnectionStringWithKey("Connection")) .ShowSql()) .Mappings(m => m .AutoMappings.Add( AutoMap.AssemblyOf <Customer>(mapCfg))) .BuildSessionFactory(); #endregion Random randomGenerator = new Random(); int random = randomGenerator.Next((int)(DateTime.Now.Ticks % (long)int.MaxValue)); using (var session = factory.OpenSession()) using (var transaction = session.BeginTransaction()) { Customer customer = new Customer(); customer.Name = "Barış_" + random.ToString(); customer.SurName = "Akan_" + random.ToString(); customer.EMail = "bakan" + random.ToString() + "@innova.com.tr"; customer.BirthDate = DateTime.Today; session.Save(customer); transaction.Commit(); session.Close(); } } catch (Exception ex) { throw ex; } }
public void Map(DataRow ori, Type tDes, object oDes, PropertyInfo dProp, AutoMappingConfig config) { }
public void Map(XmlNode ori, Type tDes, object oDes, PropertyInfo dProp, AutoMappingConfig config) { }
public void Map(Dictionary <string, object> values, Type tDes, object des, PropertyInfo dProp, AutoMappingConfig config) { }
public void Map(Type tConfig, Type tOri, object oOri, Type tDes, object oDes, PropertyInfo configProp, AutoMappingConfig config) { }