Exemplo n.º 1
0
        public override void Read(ISpmContext context, int index, TItem dest)
        {
            SpmItem <TValue> itemReader = (SpmItem <TValue>)context[this.propertyToken];

            if (itemReader == null)
            {
                itemReader = new SpmItem <TValue>(context, this.Mapped, null);
                context[this.propertyToken] = itemReader;
            }
            this.setter(dest, itemReader.Read());
        }
Exemplo n.º 2
0
        public override bool IsNull(ISpmContext context, int index)
        {
            SpmItem <TValue> itemReader = (SpmItem <TValue>)context[this.propertyToken];

            if (itemReader == null)
            {
                itemReader = new SpmItem <TValue>(context, this.Mapped, null);
                context[this.propertyToken] = itemReader;
            }
            return(itemReader.IsKeysNull());
        }
Exemplo n.º 3
0
 public SpmReader(SqlDataReader reader, SpmSharedItemPool pool = null, string group = null)
 {
     if (reader == null)
     {
         throw new ArgumentNullException("reader");
     }
     this.dataReader = reader;
     this.indices    = new Dictionary <string, int>(this.DataReader.FieldCount);
     for (int i = 0; i < this.DataReader.FieldCount; i++)
     {
         string name = this.DataReader.GetName(i);
         if (indices.ContainsKey(name))
         {
             throw new ArgumentException(String.Concat("Колонка с именем ",
                                                       name, " встречается в запросе более одного раза"));
         }
         indices.Add(name, i);
     }
     this.itemReader = new SpmItem <TItem>(this, null, group);
     this.sharedPool = pool;
 }