[fix]Config创建默认配置文件的开关Runtime.CreateConfigOnMissing,仅需对自动创建生效,而不应该阻止用户主动Save
智能大石头 authored at 2024-08-09 00:30:41 石头 committed at 2024-08-10 14:22:24
1.28 KiB
X
using System;
using NewLife.CommonEntity.Web;
using NewLife.Model;
using NewLife.Web;

namespace NewLife.CommonEntity
{
    /// <summary>通用服务</summary>
    public class CommonService //: ServiceContainer<CommonService>
    {
        #region 当前静态服务容器
        /// <summary>当前对象容器</summary>
        public static IObjectContainer Container { get { return ObjectContainer.Current; } }
        #endregion

        static CommonService()
        {
            Container
                //.AutoRegister(typeof(IManageProvider), typeof(CommonManageProvider), typeof(ManageProvider))
                //.AutoRegister(typeof(IErrorInfoProvider), typeof(CommonManageProvider), typeof(ManageProvider))
                .AutoRegister<IEntityForm, EntityForm2>()
                .AutoRegister<IManagePage, ManagePage>();

            //Container
            //    .AutoRegister<IAdministrator, Administrator>()
            //    .AutoRegister<IRole, Role>()
            //    .AutoRegister<IMenu, Menu>()
            //    .AutoRegister<ILog, Log>();
        }

        /// <summary>获取</summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static T Get<T>() { return Container.Resolve<T>(); }
    }
}