示例#1
0
 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);
         }
     }
 }
示例#2
0
 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();
 }
示例#3
0
 public EntityRepository(List <Type> types, DataAccessObject.DataAccessObject strategy, bool debug)
 {
     Init(types, strategy, debug);
 }
示例#4
0
 public EntityRepository(List <Type> types, DataAccessObject.DataAccessObject strategy)
 {
     Init(types, strategy, false);
 }