Ejemplo n.º 1
0
        protected override IEnumerator <T> GetEnumerator(DbBuffering buffering, T target = default(T))
        {
            if (typeof(T) == typeof(IDictionary <string, object>))
            {
                //TODO: Target is going to be assigned to the wrong record for ElementAt and Take because it always uses the first
                // in querybuilder, we always select the first one directly.
                if (target != null)
                {
                    throw new InvalidOperationException("Mapping to a target object in the same operation as AsDictionary is not supported.");
                }
                var enumerator = new QueryEnumerator_Dictionary <U>(Context.Connection, Context.DataStorageController, GetQuery());
                enumerator.Buffered = buffering;

                // Do not assign OnLoad event in QueryT because this should only run for nontyped/nonbound objects
                // Override in QueryBuilderT to assign the event handler.

                Enumerator = (IEnumerator <T>)enumerator;

                return(Enumerator);
            }
            else
            {
                return(base.GetEnumerator(buffering, target));
            }
        }
Ejemplo n.º 2
0
        protected virtual IEnumerator <T> GetEnumerator(DbBuffering buffering, T target = default(T))
        {
            //TODO: Target is going to be assigned to the wrong record for ElementAt and Take because it always uses the first
            // in querybuilder, we always select the first one directly.

            var enumerator = new QueryEnumerator <T>(Context.Connection, Context.DataStorageController, GetQuery());

            enumerator.Buffered = buffering;
            enumerator.Target   = Target;

            // Do not assign OnLoad event in QueryT because this should only run for nontyped/nonbound objects
            // Override in QueryBuilderT to assign the event handler.

            Enumerator = enumerator;
            return(enumerator);
        }
Ejemplo n.º 3
0
        public DbContext(IDataStorageController dsController,
                         IDbConnection connection,
                         IDbTransaction transaction      = null,
                         DbCommandOptions commandOptions = 0,
                         DbBuffering buffering           = 0,
                         DbReconnect reconnect           = 0)
        {
            Connection            = connection;
            DataStorageController = dsController;
            Transaction           = transaction;
            CommandOptions        = commandOptions == 0 ?
                                    IQ.Config.CommandOptions :
                                    commandOptions;

            Buffering = buffering == 0 ?
                        IQ.Config.Buffering :
                        buffering;
            Reconnect = reconnect == 0 ?
                        IQ.Config.Reconnect :
                        reconnect;
        }