コード例 #1
0
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterAssemblyTypes(base.ThisAssembly)
            .Where(t => t.Name.EndsWith("Repository"))
            .AsImplementedInterfaces();

            AutoMapperProfileRegister.Register();
        }
コード例 #2
0
ファイル: HomeControllerTest.cs プロジェクト: liucyi/IOC_Demo
        public void Index()
        {
            StudentService studentService = new StudentService(new StudentRepository());

            AutoMapperProfileRegister.Register();
            //   var data = studentService.Get(1).MapTo<ViewStudents>()  ;
            //  var data = studentService.GetAll(1).MapToList<ViewStudents>() ;
            var data = studentService.GetAll(1).MapToList <ViewStudents>().ToJson();
            var d    = DESEncrypt.Encrypt(data);
            var n    = DESEncrypt.Decrypt(d);
        }
コード例 #3
0
        public ActionResult Index()
        {
            AutoMapperProfileRegister.Register();
            //   var data = studentService.Get(1).MapTo<ViewStudents>()  ;
            //  var data = studentService.GetAll(1).MapToList<ViewStudents>() ;
            var data  = studentService.GetViewStudentsAll(1);
            var data1 = studentService.GetAll(1);
            var json  = data.ToJson();
            var d     = DESEncrypt.Encrypt(json);
            var n     = DESEncrypt.Decrypt(d);

            return(View(data));
        }
コード例 #4
0
        public void Configuration(IAppBuilder app)
        {
            // 有关如何配置应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=316888
            HttpConfiguration config = new HttpConfiguration();

            /// 配置MEF IOC
            MefConfig.RegisterMef(config);
            // 配置数据库初始化
            DatabaseInitializer.Initialize();
            //配置AutoMapper DToM转化
            AutoMapperProfileRegister.Register();
            //配置Token验证
            ConfiureOAuth(app);
            //这一行代码必须放在ConfiureOAuth(app)之后
            app.UseWebApi(config);
            app.UseCors(CorsOptions.AllowAll);

            WebApiConfig.Register(config);
            //GlobalConfiguration.Configure(WebApiConfig.Register);
        }