Exemple #1
0
 /// <summary>
 /// Instantiate using the default stack
 /// </summary>
 /// <param name="datastoreDb">The low-level datastore connection. Needed to generate keys.</param>
 public DatastoreOrm(DatastoreDb datastoreDb)
 {
     this.datastoreDb = datastoreDb;
     reflector        = new DatastoreReflector();
     entityFactory    = new ReflectionBasedEntityFactory(reflector);
     pocoFactory      = new ReflectionBasedPocoFactory(reflector);
 }
Exemple #2
0
 /// <summary>
 /// Instantiate with custom stack or through Depency Injection
 /// </summary>
 /// <param name="datastoreDb">The low-level datastore connection. Needed to generate keys.</param>
 /// <param name="reflector">Answers questions about a POCO</param>
 /// <param name="entityFactory">Creates entities from POCOs</param>
 /// <param name="pocoFactory">Creates POCOs from entities</param>
 public DatastoreOrm(
     DatastoreDb datastoreDb,
     DatastoreReflector reflector,
     IEntityFactory entityFactory,
     IPocoFactory pocoFactory
     )
 {
     this.datastoreDb   = datastoreDb;
     this.reflector     = reflector;
     this.entityFactory = entityFactory;
     this.pocoFactory   = pocoFactory;
 }
        public DatastoreConnection(DatastoreDb datastoreDb, DatastoreOrm orm)
        {
            this.datastoreDb = datastoreDb;

            if (orm != null)
            {
                this.orm = orm;
            }
            else
            {
                var reflector = new DatastoreReflector();

                this.orm = new DatastoreOrm(
                    datastoreDb,
                    reflector,
                    new ReflectionBasedEntityFactory(reflector),
                    new ReflectionBasedPocoFactory(reflector)
                    );
            }
        }