public XOApplication(XElement ModelElement, XElement ViewElement, XElement SecurityElement, XOApplicationConfigParams ConfigParams) { if (ModelElement == null) { throw new ArgumentException("ModelElement can't be null"); } _xopDataSet = new XOPDataSet(ModelElement); if (ViewElement != null) _xwpApplication = new XWPApplication(ViewElement); if (SecurityElement != null) _xspApplication = new XSPApplication(SecurityElement); _tables = _xopDataSet.Tables.Select(p => new XOTable(this, p, GetXWPTable(XwpApplication, p.Name), GetXSPTable(XspApplication, p.Name))).ToArray(); _configParams = ConfigParams; this.EndInit(); }
private static void InitializeDbContext(string ModelFilePath, XOPDataSet XOPDataSet) { DataAvail.Data.DbContext.IDbContext dbContext = null; switch (XOPDataSet.AdapterType) { case XOPDataSetAdapterType.Oracle: throw new AppShellInitializerException("Still not implemented, coming soon..."); case XOPDataSetAdapterType.SqlServer: dbContext = new DataAvail.DevArt.Data.MSSQL.DbContext(); break; case XOPDataSetAdapterType.SQLite: dbContext = new DataAvail.DevArt.Data.SQLite.DbContext(); //throw new AppShellInitializerException("Temporary off"); break; default: throw new AppShellInitializerException("Unknown data set's adapter type"); } dbContext.ObjectCreator.Connection.ConnectionString = ConnectionStringMacros.Parse(ModelFilePath, XOPDataSet.ConnectionString); DataAvail.Data.DbContext.DbContext.CurrentContext = dbContext; }