Esempio n. 1
0
 public MenuEntityBase()
 {
     this.PermissionValues = new Lazy_ <List <string> >(() =>
                                                        this.PermissionJson?.JsonToEntity <List <string> >(throwIfException: false) ?? new List <string>()
     {
     });
 }
Esempio n. 2
0
        public IocContext()
        {
            this._lazy = new Lazy_ <IContainer>(() =>
            {
                //创建builder
                var builder = new ContainerBuilder();
                //注册依赖
                new BaseDependencyRegistrar().Register(ref builder);
                //注册额外依赖
                if (ValidateHelper.IsPlumpList(this.ExtraRegistrars))
                {
                    foreach (var reg in this.ExtraRegistrars)
                    {
                        reg.Register(ref builder);
                        reg.Clean();
                    }
                }

                //额外的切入点
                this.OnContainerBuilding?.Invoke(ref builder);

                //创建容器
                var context = builder.Build();

                return(context);
            }).WhenDispose((ref IContainer x) => x.Dispose());
        }
Esempio n. 3
0
        public MenuEntity()
        {
            string[] ParsePermission()
            {
                var res = this.PermissionJson?.JsonToEntity <string[]>(throwIfException: false);

                return(res ?? new string[] { });
            }

            this.PermissionValues = new Lazy_ <string[]>(ParsePermission);
        }
Esempio n. 4
0
 public LazyServiceWrapperBase(string name, Func <T> source)
 {
     this._name = name;
     this._lazy = new Lazy_ <T>(source);
 }
Esempio n. 5
0
 public IocAbpDbContextProvider(IServiceProvider provider)
 {
     this._lazy = new Lazy_ <DbContextImpl>(() => provider.Resolve_ <DbContextImpl>());
 }