public RegisterOrganisationAsyncTest()
 {
     AutoMapperExtension.AddMapping(null);
 }
Beispiel #2
0
 public DeleteAsyncTest()
 {
     AutoMapperExtension.AddMapping(null);
 }
Beispiel #3
0
 public UpdateOrganisationAsyncTest()
 {
     AutoMapperExtension.AddMapping(null);
 }
Beispiel #4
0
 public Startup(IConfiguration configuration)
 {
     Configuration = configuration;
     AutoMapperExtension.Initialize();
 }
Beispiel #5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers()
            .AddNewtonsoftJson(options =>
            {
                //可设置支持返回数据键首字母按照后端设置
                //options.SerializerSettings.ContractResolver = new DefaultContractResolver();

                //忽略循环引用得问题
                //options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;

                //设置时间格式
                //options.SerializerSettings.DateFormatString = "yyyy-MM-dd";
            });

            services.AddControllersWithViews()
            .AddControllersAsServices()          //
            .AddRazorRuntimeCompilation();       //启用运行时编译

            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).
            AddCookie(x =>
            {
                x.Cookie.Name = "aehyok_login";
                //登录地址
                x.LoginPath        = "/Account/Login";
                x.AccessDeniedPath = "/Home/Error";
                x.Cookie.MaxAge    = new TimeSpan(0, 30, 0); //设置Cookie有效时间
            });

            //添加缓存
            services.AddMemoryCache();

            services.AddSenparcWeixinServices(Configuration);

            // Set the comments path for the Swagger JSON and UI.
            var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
            var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);

            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo
                {
                    Version     = "v1",
                    Title       = "咨询管理平台",
                    Description = "咨询管理平台Api对外开放接口",
                    //TermsOfService = new Uri("https://example.com/terms"),
                    //Contact = new OpenApiContact
                    //{
                    //    Name = "Shayne Boyer",
                    //    Email = string.Empty,
                    //    Url = new Uri("https://twitter.com/spboyer"),
                    //},
                    //License = new OpenApiLicense
                    //{
                    //    Name = "Use under LICX",
                    //    Url = new Uri("https://example.com/license"),
                    //}
                });
                c.IncludeXmlComments(xmlPath);
            });


            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new AutoMapping());
            });

            //引入AutoMapper
            AutoMapperExtension.AddAutoMapperProfiles(services);

            //services.AddScoped<IMapper, Mapper>();
        }
 public GetByTeamNameAsyncTest()
 {
     AutoMapperExtension.AddMapping(null);
 }
 public DeleteByOrganisationNameAsyncTest()
 {
     AutoMapperExtension.AddMapping(null);
 }
Beispiel #8
0
 public SearchConditionMain()
 {
     ReadJson.Init();
     // 设置AutoMapper映射信息
     AutoMapperExtension.RegisterAutoMapper();
 }
 public static void Config()
 {
     AutoMapperExtension.MappingRegisterList.Add(AutoMapperMappingRegister.Instance);
     AutoMapperExtension.Init();
 }
        /// <summary>
        /// 获取所有权限
        /// </summary>
        /// <returns></returns>
        public IQueryable <PermissionDto> GetAll()
        {
            var query = _permissionRepository.GetAll();

            return(AutoMapperExtension.MapTo <Permission, PermissionDto>(query).AsQueryable());
        }