private static void RegistrarObjectSpace() { string connectionString = ""; if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null) { connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; } IDataStore store = XpoDefault.GetConnectionProvider(connectionString, AutoCreateOption.SchemaAlreadyExists); XPDictionary dict = new ReflectionDictionary(); dict.GetDataStoreSchema(System.Reflection.Assembly.GetExecutingAssembly()); XpoDefault.DataLayer = new ThreadSafeDataLayer(dict, store); XpoTypesInfoHelper.ForceInitialize(); XpoTypesInfoHelper.GetXpoTypeInfoSource(); XafTypesInfo.Instance.RegisterEntity(typeof(Venta)); XafTypesInfo.Instance.RegisterEntity(typeof(TipoDocumento)); XafTypesInfo.Instance.RegisterEntity(typeof(CobroPendiente)); XafTypesInfo.Instance.RegisterEntity(typeof(ReporteCxcEmpleado)); XafTypesInfo.Instance.RegisterEntity(typeof(CorteDeCaja)); XafTypesInfo.Instance.RegisterEntity(typeof(Empleado)); XafTypesInfo.Instance.RegisterEntity(typeof(Sucursal)); XafTypesInfo.Instance.RegisterEntity(typeof(ReportDataV2)); XPObjectSpaceProvider directProvider = new XPObjectSpaceProvider(connectionString, null, true); ObjectsPaceConnection.PropObjectSpace = directProvider.CreateObjectSpace(); ObjectsPaceConnection.Session = ((XPObjectSpace)ObjectsPaceConnection.PropObjectSpace).Session; }
ApplicationModulesManager GetApplicationModulesManager(PathInfo pathInfo) { string assemblyPath = Path.GetDirectoryName(pathInfo.AssemblyPath); var designerModelFactory = new DesignerModelFactory(); ReflectionHelper.Reset(); XafTypesInfo.HardReset(); XpoTypesInfoHelper.ForceInitialize(); if (pathInfo.IsApplicationModel) { _currentDomainOnAssemblyResolvePathInfo = pathInfo; AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += CurrentDomainOnAssemblyResolve; AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve; var applicationInstance = Activator.CreateInstance(Assembly.Load(pathInfo.AssemblyPath).GetTypes().First(type => typeof(XafApplication).IsAssignableFrom(type))); AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= CurrentDomainOnAssemblyResolve; AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomainOnAssemblyResolve; _currentDomainOnAssemblyResolvePathInfo = null; var configFileName = applicationInstance is WinApplication? pathInfo.AssemblyPath + ".config":Path.Combine(pathInfo.FullPath, "web.config"); return(designerModelFactory.CreateModulesManager((XafApplication)applicationInstance, configFileName, Path.GetDirectoryName(pathInfo.AssemblyPath))); } var moduleFromFile = designerModelFactory.CreateModuleFromFile(pathInfo.AssemblyPath, assemblyPath); return(designerModelFactory.CreateModulesManager(moduleFromFile, pathInfo.AssemblyPath)); }
public static XPObjectSpaceProvider CreateObjectSpaceProvider(string connectionString) { XpoTypesInfoHelper.ForceInitialize(); ITypesInfo typesInfo = XpoTypesInfoHelper.GetTypesInfo(); XpoTypeInfoSource xpoTypeInfoSource = XpoTypesInfoHelper.GetXpoTypeInfoSource(); RegisterBOTypes(typesInfo); ConnectionStringDataStoreProvider dataStoreProvider = new ConnectionStringDataStoreProvider(connectionString); return(new XPObjectSpaceProvider(dataStoreProvider, typesInfo, xpoTypeInfoSource)); }
ApplicationModulesManager GetApplicationModulesManager(PathInfo pathInfo) { string assemblyPath = Path.GetDirectoryName(pathInfo.AssemblyPath); var designerModelFactory = new DesignerModelFactory(); var moduleFromFile = designerModelFactory.CreateModuleFromFile(pathInfo.AssemblyPath, assemblyPath); ReflectionHelper.Reset(); XafTypesInfo.HardReset(); XpoTypesInfoHelper.ForceInitialize(); return(designerModelFactory.CreateModulesManager(moduleFromFile, pathInfo.AssemblyPath)); }
private static XPObjectSpaceProvider CreateObjectSpaceProvider(string CompanyId) //TODO use companyID { XpoTypesInfoHelper.ForceInitialize(); ITypesInfo typesInfo = XpoTypesInfoHelper.GetTypesInfo(); XpoTypeInfoSource xpoTypeInfoSource = XpoTypesInfoHelper.GetXpoTypeInfoSource(); RegisterBOTypes(typesInfo); ConnectionStringDataStoreProvider dataStoreProvider = new ConnectionStringDataStoreProvider(MSSqlConnectionProvider.GetConnectionString("weedware101.database.windows.net,1433", "demodbjose", "*.mk3247", "demodbjose")); return(new XPObjectSpaceProvider(dataStoreProvider, typesInfo, xpoTypeInfoSource)); }
void Setup(Type targetType, TColumnViewEditor gridListEditor) { XpoTypesInfoHelper.ForceInitialize(); var xpObjectSpace = new XPObjectSpace(XafTypesInfo.Instance, ((XpoTypeInfoSource)XafTypesInfo.PersistentEntityStore), () => null); var collectionSource = new CollectionSource(xpObjectSpace, targetType); gridListEditor.Setup(collectionSource, new EditorsXafApplication()); gridListEditor.ColumnCreated += (sender, args) => { var column = args.Column; if (column.ColumnEdit != null) { column.ColumnEdit.Name = column.Name; column.ColumnEdit.Site = new MySite(gridListEditor.Grid.MainView, column); } }; gridListEditor.CreateControls(); }
ApplicationModulesManager GetApplicationModulesManager(PathInfo pathInfo) { var designerModelFactory = new DesignerModelFactory(); ReflectionHelper.Reset(); XafTypesInfo.HardReset(); XpoTypesInfoHelper.ForceInitialize(); if (pathInfo.IsApplicationModel) { var assembliesPath = Path.GetDirectoryName(pathInfo.AssemblyPath); var application = designerModelFactory.CreateApplicationFromFile(pathInfo.AssemblyPath, assembliesPath); InitializeTypeInfoSources(application.Modules, assembliesPath); var applicationModulesManager = designerModelFactory.CreateModulesManager(application, null, assembliesPath); return(applicationModulesManager); } var moduleFromFile = designerModelFactory.CreateModuleFromFile(pathInfo.AssemblyPath, Path.GetDirectoryName(pathInfo.AssemblyPath)); return(designerModelFactory.CreateModulesManager(moduleFromFile, pathInfo.AssemblyPath)); }