public void Export(DataAccessObject.DataAccessObject strategy) { foreach (Type type in this.Types) { strategy.CreateSchema(type); } foreach (Type type in this.Types) { foreach (Entity e in this.Entities[type]) { strategy.SaveEntity(e); } } }
public void Init(List <Type> types, DataAccessObject.DataAccessObject strategy, bool debug) { // dataAccessObject = new SQLiteStrategy("db.sqlite", types, debug); //dataAccessObject = new MysqlStrategy("localhost","test", "root", "", types, debug); //dataAccessObject = new XmlStrategyPrototype(); dataAccessObject = strategy; Types = types; Entities = new Dictionary <Type, List <Entity> >(); NextId = new Dictionary <Type, int>(); _Mementos = new List <Memento>(); Mementos = new List <Dictionary <Entity, bool> >(); foreach (Type type in Types) { CreateSchema(type); NextId[type] = dataAccessObject.GetNextId(type); //NextId[entry.Value] = 1; Entities[type] = new List <Entity>(); } Pull(); }
public EntityRepository(List <Type> types, DataAccessObject.DataAccessObject strategy, bool debug) { Init(types, strategy, debug); }
public EntityRepository(List <Type> types, DataAccessObject.DataAccessObject strategy) { Init(types, strategy, false); }