Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of <see cref="EntityContext{T}"/>
        /// </summary>
        /// <param name="connection"></param>
        public EntityContext(EntityContextConnection connection)
        {
            _connection     = connection;
            _collectionName = typeof(T).Name;

            _collection = _connection.Database.GetCollection <T>(_collectionName);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of <see cref="EntityContext{T}"/>
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="classMaps"></param>
        public EntityContext(EntityContextConnection connection, IInstancesOf <BsonClassMap> classMaps)
        {
            _connection     = connection;
            _collectionName = typeof(T).Name;

            _collection = _connection.Database.GetCollection <T>(_collectionName);

            RegisterClassMapsIfNotRegistered(classMaps);
        }