Ejemplo n.º 1
0
        public object Execute(Expression expression)
        {
            TranslateResult result = this.Translate(expression);

            if (result.SQLCommand != null)
            {
                this.misession.Do(result.SQLCommand);
            }

            Type elementType = TypeSystem.GetElementType(expression.Type);


            IMapInfoDataReader reader = this.readerfactory.GetReaderFor(result.TableName);
            ITable             table  = this.misession.Tables.GetTable(result.TableName);

            EntityMaterializer materializer = this.entityfactory.CreateMaterializerFor(table, reader);

            if (result.Projector != null)
            {
                Delegate projector = result.Projector.Compile();

                return(Activator.CreateInstance(typeof(ProjectionReader <>).MakeGenericType(elementType),
                                                new object[] { reader, projector }));
            }

            return(Activator.CreateInstance(typeof(RowList <>).MakeGenericType(elementType),
                                            new object[] { reader, materializer }));
        }
Ejemplo n.º 2
0
 public RowList(IMapInfoDataReader reader, EntityMaterializer factory)
 {
     this.reader        = reader;
     this.entityfactory = factory;
 }
 public EntityMaterializer CreateMaterializerFor(ITable table, IMapInfoDataReader reader)
 {
     return(new EntityMaterializer(this.misession, table, reader));
 }
Ejemplo n.º 4
0
 internal Enumerator(IMapInfoDataReader reader, Func <IMapInfoDataReader, T> projector)
 {
     this.reader    = reader;
     this.projector = projector;
 }
Ejemplo n.º 5
0
 public ProjectionReader(IMapInfoDataReader reader, Func <IMapInfoDataReader, T> projector)
 {
     this.enumerator = new Enumerator(reader, projector);
 }
Ejemplo n.º 6
0
 public EntityMaterializer(MapInfoSession miSession, ITable table, IMapInfoDataReader mapInfoDataReader)
 {
     this.MapifoSession = miSession;
     this.datareader    = mapInfoDataReader;
     this.Table         = table;
 }
Ejemplo n.º 7
0
 public RowEnumerator(IMapInfoDataReader recordSelector, EntityMaterializer entityFactory)
 {
     this.datareader    = recordSelector;
     this.entityfactory = entityFactory;
 }