Ejemplo n.º 1
0
        private async Task <PagedResult <TModel> > SortItems <TModel>(IModelConfig modelConfig, int pageNo, int pageSize, object itemObj, string childModel) where TModel : class
        {
            var items = ((JArray)itemObj).ToObject <IList <TModel> >(_serializer);

            if (_adminSite.AdminType == AdminType.Entity)
            {
                return(await _adminRepository.SortItemsFor(pageNo, pageSize, items));
            }

            var onSortDel = modelConfig.GridConfig.OnSortExpression.Compile();
            var result    = await(dynamic) onSortDel.DynamicInvoke(_serviceProvider, pageNo, pageSize, items) as PagedResult <TModel>;

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Start the system
        /// </summary>
        /// <param name="host"></param>
        /// <param name="world"></param>
        public void start(IHost host, IWorld world)
        {
            try {
                //DB.Print("EntryPoint.Start()");
                domain = AppDomain.CurrentDomain;

                name = host.Object.Name;

                if (running)
                {
                    Stop();
                }

                if (getLevel() > 3)
                {
                    phys       = ViewLayerFactory.createPhysicalLayer(host, world);
                    view       = ViewLayerFactory.createViewLayer(host, world);
                    net        = ModelLayerFactory.createNetworkLayer();
                    sim        = ModelLayerFactory.createSimulationLayer();
                    initLayer  = InitialisationFactory.createInitialisationLayer(net, sim, phys, view);
                    controller = ControllerLayerFactory.createControllerLayer(initLayer, host, world);
                }

                host.Object.Name = "Controller";

                try {
                    //controller.startup();
                } catch (Exception e) {
                    DB.Exception(e, "Unable to start controller", Levels.STARTUP);
                }

                running = true;
            } catch (Exception e) {
                DB.Exception(e, "Startup failed", Levels.STARTUP);
                Stop();
            }
            Thread autoShutdown = new Thread(autoShutdownThread);

            autoShutdown.Name = "Auto Shutdown Thread";
            autoShutdown.Start();
            Util.Wait(500);
            DB.Print("I am root");
            DB.Print("Root: I just started auto shutdown thread and I am running in thread " + Thread.CurrentThread.Name, Levels.DEBUG);
            DB.Print("Root: My stack trace is:");
            DB.StackTrace();
        }
Ejemplo n.º 3
0
 public GridFilter(IModelConfig <TSource> modelConfig, int pgSize = 20)
 {
     config   = modelConfig;
     pageSize = pgSize;
 }
Ejemplo n.º 4
0
 public static GridFilter <TSource> CreateInstance <TSource>(IModelConfig <TSource> modelConfig, int pgSize = 20)
 {
     return(new GridFilter <TSource>(modelConfig, pgSize));
 }
Ejemplo n.º 5
0
 internal static void AddConfiguration <T>(this ModelBuilder builder, IModelConfig <T> config)
     where T : class, IEntity =>
 config.Configure(builder.Entity <T>());