예제 #1
0
        public void ModifyIndexes()
        {
            for (short i = 0; i < Entities.Count; i++)
            {
                var context = new PipelineContext(new NullLogger(), this, Entities[i]);
                context.Entity.Index = i;

                foreach (var field in context.Entity.GetAllFields())
                {
                    field.EntityIndex = i;
                }

                if (!context.Entity.IsMaster)
                {
                    continue;
                }

                // set the master indexes
                short masterIndex = -1;
                var   fields      = context.GetAllEntityFields().ToArray();
                foreach (var field in fields)
                {
                    field.MasterIndex = ++masterIndex;
                }

                // set the process calculated fields starting where master entity fields left off
                if (!CalculatedFields.Any())
                {
                    continue;
                }

                var index = fields.Where(f => f.Index < short.MaxValue).Select(f => f.Index).Max();
                foreach (var field in CalculatedFields)
                {
                    field.Index = ++index;
                }
            }

            foreach (var field in GetAllFields())
            {
                var tCount = 0;
                foreach (var transform in field.Transforms)
                {
                    transform.Index = tCount++;
                }
            }
        }
예제 #2
0
        public override void LoadEntity(ContainerBuilder builder, Process process, Entity entity)
        {
            var type = process.Pipeline == "defer" ? entity.Pipeline : process.Pipeline;

            builder.Register <IPipeline>((ctx) => {
                var context = new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity);
                IPipeline pipeline;
                switch (type)
                {
                case "parallel.linq":
                    context.Debug("Registering {0} pipeline.", type);
                    pipeline = new ParallelPipeline(new DefaultPipeline(ctx.ResolveNamed <IEntityController>(entity.Key), context));
                    break;

                default:
                    context.Debug("Registering linq pipeline.", type);
                    pipeline = new DefaultPipeline(ctx.ResolveNamed <IEntityController>(entity.Key), context);
                    break;
                }

                var provider = process.Connections.First(c => c.Name == "output").Provider;

                // extract
                pipeline.Register(ctx.ResolveNamed <IRead>(entity.Key));

                // transform
                pipeline.Register(new DefaultTransform(context, context.GetAllEntityFields()));
                pipeline.Register(new TflHashCodeTransform(context));
                pipeline.Register(TransformFactory.GetTransforms(ctx, process, entity, entity.GetAllFields().Where(f => f.Transforms.Any())));
                pipeline.Register(new StringTruncateTransfom(context));

                if (provider == "sqlserver")
                {
                    pipeline.Register(new MinDateTransform(context, new DateTime(1753, 1, 1)));
                }

                //load
                pipeline.Register(ctx.ResolveNamed <IWrite>(entity.Key));
                pipeline.Register(ctx.ResolveNamed <IUpdate>(entity.Key));
                return(pipeline);
            }).Named <IPipeline>(entity.Key);
        }
예제 #3
0
        public override void LoadEntity(ContainerBuilder builder, Process process, Entity entity) {
            var type = process.Pipeline == "defer" ? entity.Pipeline : process.Pipeline;

            builder.Register<IPipeline>((ctx) => {
                var context = new PipelineContext(ctx.Resolve<IPipelineLogger>(), process, entity);
                IPipeline pipeline;
                switch (type) {
                    case "parallel.linq":
                        context.Debug("Registering {0} pipeline.", type);
                        pipeline = new ParallelPipeline(new DefaultPipeline(ctx.ResolveNamed<IEntityController>(entity.Key), context));
                        break;
                    default:
                        context.Debug("Registering linq pipeline.", type);
                        pipeline = new DefaultPipeline(ctx.ResolveNamed<IEntityController>(entity.Key), context);
                        break;
                }

                var provider = process.Connections.First(c => c.Name == "output").Provider;

                // extract
                pipeline.Register(ctx.ResolveNamed<IRead>(entity.Key));

                // transform
                pipeline.Register(new DefaultTransform(context, context.GetAllEntityFields()));
                pipeline.Register(new TflHashCodeTransform(context));
                pipeline.Register(TransformFactory.GetTransforms(ctx,process, entity, entity.GetAllFields().Where(f=>f.Transforms.Any())));
                pipeline.Register(new StringTruncateTransfom(context));

                if (provider == "sqlserver") {
                    pipeline.Register(new MinDateTransform(context, new DateTime(1753, 1, 1)));
                }

                //load
                pipeline.Register(ctx.ResolveNamed<IWrite>(entity.Key));
                pipeline.Register(ctx.ResolveNamed<IUpdate>(entity.Key));
                return pipeline;

            }).Named<IPipeline>(entity.Key);
        }
예제 #4
0
        public void ModifyIndexes()
        {
            short entityIndex = -1;

            for (int i = 0; i < Entities.Count; i++)
            {
                short masterIndex = -1;
                var   context     = new PipelineContext(new NullLogger(), this, Entities[i]);
                context.Entity.Index = ++entityIndex;
                short fieldIndex  = -1;
                short stringIndex = -1;
                foreach (var field in context.GetAllEntityFields())
                {
                    field.EntityIndex = context.Entity.Index;
                    field.Index       = ++fieldIndex;
                    field.StringIndex = field.Is("string") ? ++stringIndex : (short)-1;
                    if (context.Entity.IsMaster)
                    {
                        field.MasterIndex = ++masterIndex;
                    }
                }
            }
        }
예제 #5
0
        public void ModifyIndexes() {
            short entityIndex = -1;
            for (int i = 0; i < Entities.Count; i++) {
                short masterIndex = -1;
                var context = new PipelineContext(new NullLogger(), this, Entities[i]);
                context.Entity.Index = ++entityIndex;
                short fieldIndex = -1;
                short stringIndex = -1;
                foreach (var field in context.GetAllEntityFields()) {
                    field.EntityIndex = context.Entity.Index;
                    field.Index = ++fieldIndex;
                    field.StringIndex = field.Is("string") ? ++stringIndex : (short)-1;
                    if (context.Entity.IsMaster) {
                        field.MasterIndex = ++masterIndex;
                    }
                }
            }

        }