private void Connect(DevExpress.Xpo.DB.AutoCreateOption autoCreateOption) { if (!Connected) { XpoDefault.Session = null; Connected = true; } }
public static IDataLayer CrearConexion(string stringConexion, DevExpress.Xpo.DB.AutoCreateOption option) { try { return(datalayer = XpoDefault.GetDataLayer(stringConexion, AutoCreateOption.None)); } catch (Exception ex) { //Poner mensaje de error return(null); } }
public static bool CrearDataBase(string stringConexion, DevExpress.Xpo.DB.AutoCreateOption option) // Crea o Actualiza la BBDD { try { using (Session session = new Session(XpoDefault.GetDataLayer(stringConexion, option))) { session.UpdateSchema(ConnectionHelper.GetPersistentTypes()); session.CreateObjectTypeRecords(); } return(true); } catch (Exception ex) { return(false); } }
public static void Connect(IConfiguration configuration, DevExpress.Xpo.DB.AutoCreateOption autoCreateOption, bool threadSafe = false) { if (threadSafe) { var provider = GetConnectionProvider(configuration, autoCreateOption); var dictionary = new DevExpress.Xpo.Metadata.ReflectionDictionary(); dictionary.GetDataStoreSchema(persistentTypes); dictionary.CollectClassInfos(nonPersistentTypes); XpoDefault.DataLayer = new ThreadSafeDataLayer(dictionary, provider); } else { var provider = new OrmCookbookProvider(new SqlConnection(configuration.GetConnectionString(ConnectionStringName)), autoCreateOption); XpoDefault.DataLayer = new SimpleDataLayer(provider); } }
public static void Connect(DevExpress.Xpo.DB.AutoCreateOption autoCreateOption, bool threadSafe = false) { ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; if (threadSafe) { var provider = XpoDefault.GetConnectionProvider(ConnectionString, autoCreateOption); var dictionary = new DevExpress.Xpo.Metadata.ReflectionDictionary(); dictionary.GetDataStoreSchema(persistentTypes); XpoDefault.DataLayer = new ThreadSafeDataLayer(dictionary, provider); } else { XpoDefault.DataLayer = XpoDefault.GetDataLayer(ConnectionString, autoCreateOption); } //UseInMemoryStore = true; if (UseInMemoryStore) { XpoDefault.DataLayer = new SimpleDataLayer(new InMemoryDataStore()); } XpoDefault.Session = null; }
public static IDataLayer GetDataLayer(DevExpress.Xpo.DB.AutoCreateOption autoCreateOption) { return(XpoDefault.GetDataLayer(ConnectionString, autoCreateOption)); }
public static DevExpress.Xpo.DB.IDataStore GetConnectionProvider(DevExpress.Xpo.DB.AutoCreateOption autoCreateOption, out IDisposable[] objectsToDisposeOnDisconnect) { return(XpoDefault.GetConnectionProvider(ConnectionString, autoCreateOption, out objectsToDisposeOnDisconnect)); }
public static DevExpress.Xpo.DB.IDataStore GetConnectionProvider(DevExpress.Xpo.DB.AutoCreateOption autoCreateOption) { return(XpoDefault.GetConnectionProvider(ConnectionString, autoCreateOption)); }
public static IDataLayer GetDataLayer(IConfiguration configuration, DevExpress.Xpo.DB.AutoCreateOption autoCreateOption) { return(XpoDefault.GetDataLayer(configuration.GetConnectionString(ConnectionStringName), autoCreateOption)); }
public static DevExpress.Xpo.DB.IDataStore GetConnectionProvider(IConfiguration configuration, DevExpress.Xpo.DB.AutoCreateOption autoCreateOption) { return(XpoDefault.GetConnectionProvider(configuration.GetConnectionString(ConnectionStringName), autoCreateOption)); }