コード例 #1
0
ファイル: AddCommand.cs プロジェクト: nelly2k/one
 public AddCommand(OneContext oneContext,
                   IMapper mapper, IDateTimeService dateTimeService)
 {
     this.oneContext      = oneContext;
     this.mapper          = mapper;
     this.dateTimeService = dateTimeService;
 }
コード例 #2
0
ファイル: AddStoryCommand.cs プロジェクト: nelly2k/one
 public AddStoryCommand(OneContext context, IDateTimeService dateTimeService,
                        IMapper mapper)
 {
     this.context         = context;
     this.dateTimeService = dateTimeService;
     this.mapper          = mapper;
 }
コード例 #3
0
 private void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_context != null)
         {
             _context.Dispose();
             _context = null;
         }
     }
 }
コード例 #4
0
ファイル: BaseInMemoryTest.cs プロジェクト: nelly2k/one
        public void BaseInMemoryTestSetup()
        {
            var serviceCollection = new ServiceCollection()
                                    .AddEntityFrameworkInMemoryDatabase()
                                    .AddAutoMapper(typeof(Startup));

            _serviceProvider = serviceCollection.BuildServiceProvider();
            var options = new DbContextOptionsBuilder <OneContext>()
                          .UseInMemoryDatabase("OneContext")
                          .UseInternalServiceProvider(_serviceProvider)
                          .Options;

            _context = new OneContext(options);
            _context.Database.EnsureCreated();
        }
コード例 #5
0
        public OneContext one()
        {
            OneContext _localctx = new OneContext(_ctx, State);

            EnterRule(_localctx, 6, RULE_one);
            try {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 23; Match(NUMBER);
                }
            }
            catch (RecognitionException re) {
                _localctx.exception = re;
                _errHandler.ReportError(this, re);
                _errHandler.Recover(this, re);
            }
            finally {
                ExitRule();
            }
            return(_localctx);
        }
コード例 #6
0
 public UnitOfWork(OneContext context)
 {
     _context = context;
 }
コード例 #7
0
 public HomeController(OneContext context) => this.context = context;
コード例 #8
0
 public SearchStoryQuery(OneContext oneContext, IMapper mapper)
 {
     this.oneContext = oneContext;
     this.mapper     = mapper;
 }
コード例 #9
0
ファイル: GetFeatureListQuery.cs プロジェクト: nelly2k/one
 public GetFeatureListQuery(OneContext context)
 {
     this.context = context;
 }
コード例 #10
0
 public CommentsController(AuthStore authStore, OneContext context)
 {
     AuthStore = authStore;
     Context   = context;
 }
コード例 #11
0
 public GEParentescoRepository(OneContext context) : base(context)
 {
 }
コード例 #12
0
 public StoryExistsImpl(OneContext oneContext)
 {
     this.oneContext = oneContext;
 }
コード例 #13
0
 public GEEndercoRepository(OneContext context) : base(context)
 {
 }
コード例 #14
0
ファイル: UsersController.cs プロジェクト: crclz/mirthful
 public UsersController(OneContext context)
 {
     Context = context;
 }
コード例 #15
0
 public SEGUsuarioRepositopry(OneContext context) : base(context)
 {
 }
コード例 #16
0
ファイル: WorkController.cs プロジェクト: crclz/mirthful
 public WorkController(OneContext context)
 {
     Context = context;
 }
コード例 #17
0
 protected virtual void Application_EndRequest()
 {
     OneContext.End();
 }
コード例 #18
0
 protected virtual void Application_BeginRequest()
 {
     OneContext.Begin();
 }
コード例 #19
0
 public UpdateStoryCommand(OneContext oneContext, IUpdateCommand updateCommand)
 {
     this.oneContext    = oneContext;
     this.updateCommand = updateCommand;
 }
コード例 #20
0
 public ACNivelRepository(OneContext context) : base(context)
 {
 }
コード例 #21
0
 public UnitOfWorkTransaction(OneContext db) => _db = db;
コード例 #22
0
 public AccessController(OneContext context, AuthStore store, SecretStore secretStore)
 {
     Context          = context;
     Store            = store;
     this.secretStore = secretStore;
 }
コード例 #23
0
 public GECidadeRepository(OneContext context) : base(context)
 {
 }
コード例 #24
0
 public GEUFRepository(OneContext context) : base(context)
 {
 }
コード例 #25
0
 public TopicCreatedEventHandler(OneContext context)
 {
     Context = context;
 }
コード例 #26
0
ファイル: Program.cs プロジェクト: crclz/mirthful
 static void Main(string[] args)
 {
     var context = new OneContext(new Microsoft.EntityFrameworkCore.DbContextOptions <OneContext>());
 }
コード例 #27
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            using (var context = new OneContext(new DbContextOptions <OneContext>()))
            {
                context.Database.Migrate();
            }

            // Secret store for JWT
            // TODO: put secret in env in docker-compose
            var secret = new byte[] { 164, 60, 194, 0, 161, 189, 41, 38, 130, 89, 141, 164, 45,
                                      170, 159, 209, 69, 137, 243, 216, 191, 131, 47, 250, 32, 107, 231, 117, 37, 158, 225, 234 };

            services.AddSingleton(s => new SecretStore(secret));

            services.AddControllers(p => p.Filters.Add(new MyModelFilter())).AddNewtonsoftJson(cfg =>
            {
                // contact generated by swagger does not include the number value of enum,
                // so the safest way of building contract of enum types is string.
                cfg.SerializerSettings.Converters.Add(new StringEnumConverter());
            });

            services.Configure <ApiBehaviorOptions>(options => options.SuppressModelStateInvalidFilter = true);

            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo {
                    Title = "TheAPI", Version = "v1"
                });
                c.CustomOperationIds(apiDesc =>
                {
                    return(apiDesc.TryGetMethodInfo(out MethodInfo methodInfo) ? methodInfo.Name : null);
                });

                // Without this, client cannot send correct data
                c.DescribeAllEnumsAsStrings();
                var filePath = Path.Combine(System.AppContext.BaseDirectory, "Leopard.API.xml");
                c.IncludeXmlComments(filePath);
            });

            // The c# world has get used to the behavior of Newtonsoft.Json.
            // There's no reason of switching to System.Text.Json
            services.AddSwaggerGenNewtonsoftSupport();

            services.AddScoped <AuthenticationMiddleware>();

            services.AddMediatR(Assembly.GetExecutingAssembly());
            services.AddDbContext <OneContext>();
            services.AddScoped <AuthStore>();

            var blobStorePath = Environment.GetEnvironmentVariable("BLOB_STORE");

            blobStorePath = blobStorePath ?? throw new InvalidOperationException("$BLOB_STORE is null");
            services.AddTransient <IBlobBucket>((s) => new FileBucket(new DirectoryInfo(blobStorePath), "/blob"));

            // add filters
            Assembly.GetExecutingAssembly().GetTypes()
            .Where(p => p.GetInterfaces().Contains(typeof(IAsyncActionFilter)))
            .ToList().ForEach(filterType => services.AddTransient(filterType));

            // add pipeline contexts
            Assembly.GetExecutingAssembly().GetTypes()
            .Where(p => p.GetInterfaces().Contains(typeof(IPipelineContext)))
            .ToList().ForEach(contextType => services.AddScoped(contextType));
        }
コード例 #28
0
 public GetStoryQuery(OneContext context,
                      IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
コード例 #29
0
 public DeleteOptionCommand(OneContext oneContext)
 {
     this.oneContext = oneContext;
 }
コード例 #30
0
 public TopicTest()
 {
     Context = new OneContext(new DbContextOptions <OneContext>());
 }