Exemplo n.º 1
0
        public static IContext CreateContext()
        {
            // The only reason for all this code is to relate the XML persistence location
            // to the web root, which is not the same as the current directory.

            PersistenceConfiguration persistenceConfiguration = PersistenceConfigurationHelper.GetPersistenceConfiguration();

            string location     = persistenceConfiguration.Location;
            bool   isXmlContext = persistenceConfiguration.ContextType == "Xml";

            if (isXmlContext)
            {
                location = HostingEnvironment.MapPath("~/" + location);
            }

            IContext context = ContextFactory.CreateContext(
                persistenceConfiguration.ContextType,
                location,
                persistenceConfiguration.ModelAssembly,
                persistenceConfiguration.MappingAssembly,
                persistenceConfiguration.Dialect);

            return(context);
        }
Exemplo n.º 2
0
        public static IContext CreateContext()
        {
            PersistenceConfiguration persistenceConfiguration = PersistenceConfigurationHelper.GetPersistenceConfiguration();

            return(ContextFactory.CreateContextFromConfiguration());
        }