public void Build() { if (!_validator.IsValid()) { throw new ApplicationException(_validator.Message); } IDataStore dataStore = null; IORMFramework ormFramework = null; /***************************************************************** * 1 - Create a DataStore object * This creates the logic for the CRUD methods that are injected * into the classes created with the ORM Framework. * **************************************************************/ try { object[] parms = new object[1] { _context }; dataStore = (IDataStore)Activator.CreateInstance(Type.GetType(_dataStoreName), parms); } catch (Exception ex) { throw new Exception("Error creating instance of " + _dataStoreName + " - " + ex.Message); } /***************************************************************** * 2 - Create a ORMFramework object * An ORM Framework might be something like, EntityFramework, * Linq-To-Sql, EntitySpaces, etc. This class takes a datastore * object which contains the basic CRUD method implementations. * **************************************************************/ try { object[] ormParms = new object[2] { dataStore, _context }; ormFramework = (IORMFramework)Activator.CreateInstance(Type.GetType(_ormFrameworkName), ormParms); } catch (Exception ex) { throw new Exception("Error creating instance of " + _ormFrameworkName + " - " + ex.Message); } /***************************************************************** * 3 - Create a DataPattern object * This could be a RepositoryPattern object or some other * custom pattern that you create. It takes the ORM Framework. * **************************************************************/ try { object[] patternParms = new object[2] { ormFramework, _context }; _dataPattern = (IDataPattern)Activator.CreateInstance(Type.GetType(_dataPatternName), patternParms); _dataPattern.Render(); } catch (Exception ex) { throw new Exception("Error creating instance of " + _dataPatternName + " - " + ex.Message); } }
public void Build() { if (!_validator.IsValid()) throw new ApplicationException(_validator.Message); IDataStore dataStore = null; IORMFramework ormFramework = null; /***************************************************************** * 1 - Create a DataStore object * This creates the logic for the CRUD methods that are injected * into the classes created with the ORM Framework. * **************************************************************/ try { object[] parms = new object[1] { _context }; dataStore = (IDataStore)Activator.CreateInstance(Type.GetType(_dataStoreName), parms); } catch (Exception ex) { throw new Exception("Error creating instance of " + _dataStoreName + " - " + ex.Message); } /***************************************************************** * 2 - Create a ORMFramework object * An ORM Framework might be something like, EntityFramework, * Linq-To-Sql, EntitySpaces, etc. This class takes a datastore * object which contains the basic CRUD method implementations. * **************************************************************/ try { object[] ormParms = new object[2] { dataStore, _context }; ormFramework = (IORMFramework)Activator.CreateInstance(Type.GetType(_ormFrameworkName), ormParms); } catch (Exception ex) { throw new Exception("Error creating instance of " + _ormFrameworkName + " - " + ex.Message); } /***************************************************************** * 3 - Create a DataPattern object * This could be a RepositoryPattern object or some other * custom pattern that you create. It takes the ORM Framework. * **************************************************************/ try { object[] patternParms = new object[2] { ormFramework, _context }; _dataPattern = (IDataPattern)Activator.CreateInstance(Type.GetType(_dataPatternName), patternParms); _dataPattern.Render(); } catch (Exception ex) { throw new Exception("Error creating instance of " + _dataPatternName + " - " + ex.Message); } }