protected override void Load(ContainerBuilder builder) { builder.RegisterAssemblyTypes(base.ThisAssembly) .Where(t => t.Name.EndsWith("Repository")) .AsImplementedInterfaces(); AutoMapperProfileRegister.Register(); }
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); }
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)); }
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); }