/// <summary> /// Compiles and executes the Query against the databasecontext /// </summary> /// <param name="context">The database context</param> public void Execute(IDatabaseContext context) { var expr = context.ConnectionProvider.QueryCompiler; var query = expr.Compile(QueryParts, context.Interceptors); context.Kernel.Execute(query); }
internal Database(DatabaseSystem system, IDatabaseContext context) { System = system; Context = context; Name = Context.DatabaseName(); DiscoverDataVersion(); TableComposite = new TableSourceComposite(this); Context.RegisterInstance(this); Context.RegisterInstance<ITableSourceComposite>(TableComposite); Locker = new Locker(this); Sessions = new ActiveSessionList(this); // Create the single row table var t = new TemporaryTable(context, "SINGLE_ROW_TABLE", new ColumnInfo[0]); t.NewRow(); SingleRowTable = t; TransactionFactory = new DatabaseTransactionFactory(this); }
protected AccountBasedManagement(IDatabaseContext context, int personId, int accountId) : base(context, personId) { var permission = MyPermissions.Single(x => x.Key.Id == accountId); AccountGroup = permission.Key; AccountGroupPermission = permission.Value; }
public UnitOfWork(IDatabaseContext context) { _context = context; _context.OpenConnection(); _transaction = _context.Connection.BeginTransaction(IsolationLevel.ReadCommitted); }
public ApiKeyManagement(IDatabaseContext context, int personId, int accountId) : base(context, personId, accountId) { if (!CanDoStuff) { throw new UnauthorizedAccessException("You are not an administrative user."); } }
protected UserRestrictedDatabaseLink(IDatabaseContext context, int personId) : base(context) { //TODO: Only admins can reactivate their account. _person = Context.List<Person>().Single(x => x.Id == personId && !x.DisabledDate.HasValue); }
public TransactionContext(IDatabaseContext databaseContext) : base(databaseContext) { VariableManager = new VariableManager(this); CursorManager = new CursorManager(this); EventRegistry = new TransactionRegistry(this); }
protected virtual IDatabase CreateDatabase(IDatabaseContext context) { var database = new Database(context); database.Create(AdminUserName, AdminPassword); database.Open(); return database; }
public LogService(long subscriptionId, IDatabaseContext context) { if (context == null) throw new ArgumentNullException("context"); Database = context; SubscriptionId = subscriptionId; }
public SystemRoutineProvider(IDatabaseContext context) { if (context == null) throw new ArgumentNullException("context"); Context = context; resolvers = new Dictionary<Type, IRoutineResolver>(); }
public ProjectContext(IDatabaseContext context, long projectId) { if (context == null) throw new ArgumentNullException("context"); Database = context; ProjectId = projectId; Errors = new List<Tuple<string, string>>(); }
public SingleFileStoreSystem(IDatabaseContext context, IConfiguration configuration) { if (context == null) throw new ArgumentNullException("context"); this.context = context; Configure(configuration); OpenOrCreateFile(); }
public Collector(IDatabaseContext context) { _context = context; Items = new ItemRepository(_context); Ingredients = new IngredientRepository(_context); Foodplans = new FoodplanRepository(_context); Shoppinglists = new ShoppinglistRepository(_context); Recipes = new RecipeRepository(_context); Users = new UserRepository(_context); }
public CreateSaleCommand( IDateService dateService, IDatabaseContext database, ISaleFactory factory, IInventoryClient client) { _dateService = dateService; _database = database; _factory = factory; _client = client; }
public static void InitializeNHibernate(params Assembly[] assemblies) { if (SessionFactory != null) return; Console.WriteLine("Creating a new SessionFactory"); #if SQLEXPRESS SessionFactory = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2000 .ConnectionString( c => c.Is( @"Data Source=.\SQLEXPRESS;Initial Catalog=Test;Integrated Security=True;Pooling=False")) .ShowSql()) .Mappings(m => Array.ForEach(assemblies, a => m.FluentMappings.AddFromAssembly(a))) .ExposeConfiguration(configuration => { configuration.SetProperty("current_session_context_class", "call"); Configuration = configuration; }) .BuildSessionFactory(); #endif #if SQLITE SessionFactory = Fluently.Configure() .Database(SQLiteConfiguration.Standard .InMemory() .ShowSql()) .Mappings(m => Array.ForEach(assemblies, a => m.FluentMappings.AddFromAssembly(a))) .ExposeConfiguration(configuration => { configuration.SetProperty("current_session_context_class", "call"); Configuration = configuration; }) .BuildSessionFactory(); #endif DatabaseContext = new NHibernateDatabaseContext(new NHibernateSessionContextManager(SessionFactory), SessionFactory); var session = SessionFactory.OpenSession(); CurrentSessionContext.Bind(session); // Export Schema new SchemaExport(Configuration).Execute( /* script to console is */ false, /* export to database is */ true, /* drop only is */ false, session.Connection, /* TextWriter is */ null); }
public void SetUp_for_tests() { // Create mock for Unit of work mockData = Substitute.For<IDatabaseContext>(); mockData.DbSetIngredients.Returns(inMemoryIngredients); _testCollector = new Collector(mockData); }
public void SetUp() { var builder = new ContainerBuilder(); _ravenDbContext = MockRepository.GenerateStub<IDatabaseContext>(); var stubDocumentSession = MockRepository.GenerateStub<IDocumentSession>(); _ravenDbContext.Stub(x => x.OpenSession()).Return(stubDocumentSession); builder.RegisterInstance(_ravenDbContext).As<IDatabaseContext>(); builder.RegisterModule<DatabaseSessionModule>(); base.BuildAndCreateTestDependencyResolver(builder); }
public Database(IDatabaseContext context) { DatabaseContext = context; DiscoverDataVersion(); TableComposite = new TableSourceComposite(this); // Create the single row table var t = new TemporaryTable(context, "SINGLE_ROW_TABLE", new ColumnInfo[0]); t.NewRow(); SingleRowTable = t; TransactionFactory = new DatabaseTransactionFactory(this); }
public void TestSetup() { systemContext = new SystemContext(); var test = TestContext.CurrentContext.Test.Name; if (test != "CreateNewContext") { databaseContext = new DatabaseContext(systemContext, TestDbName); } if (test != "CreateNew" && test != "DatabaseNotExists" && test != "CreateNewContext") { database = new Database(databaseContext); database.Create(TestAdminUser, TestAdminPass); database.Open(); } }
private static void Log(string message, LogEntryLevel level, long subscriptionId, IDatabaseContext context = null) { var log = new Log { SubscriptionId = subscriptionId, Message = message, Level = level }; if (context != null) { Log(log, context); } else { using (var newContext = new DatabaseContext()) { Log(log, newContext); } } }
private static void Log(Exception exception, LogEntryLevel level, long subscriptionId, IDatabaseContext context = null) { var log = new Log { SubscriptionId = subscriptionId, Message = exception.Message, Level = level, Source = exception.Source, StackTrace = exception.StackTrace }; if (context != null) { Log(log, context); } else { using (var newContext = new DatabaseContext()) { Log(log, newContext); } } }
public ProductReviewRepository(IDatabaseContext databaseContext) { _databaseContext = databaseContext; }
public GetSpecificationAttributeQueryHandler(IDatabaseContext dbContext) { _dbContext = dbContext; }
/// <summary> /// Construct a <see cref="UserController"/> /// </summary> /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param> /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param> /// <param name="systemIdentityFactory">The value of <see cref="systemIdentityFactory"/></param> /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/></param> /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/>.</param> /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/></param> public UserController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, ISystemIdentityFactory systemIdentityFactory, ICryptographySuite cryptographySuite, ILogger <UserController> logger, IOptions <GeneralConfiguration> generalConfigurationOptions) : base(databaseContext, authenticationContextFactory, logger, false, true) { this.systemIdentityFactory = systemIdentityFactory ?? throw new ArgumentNullException(nameof(systemIdentityFactory)); this.cryptographySuite = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite)); generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions)); }
public RiderRepository(IDatabaseContext databaseContext, ICountryRepository countryRepository) { _context = databaseContext; _countryRepository = countryRepository; }
public NotifyDataAccess(IDatabaseContext databaseContext, IMapper mapper) => (this.databaseContext, this.mapper) = (databaseContext, mapper);
public RecurringExpenseRepository(IDatabaseContext conn, LogService logService, ICreditCardRepository creditCardRepository) : base(conn, logService) { _creditCardRepository = creditCardRepository; }
public RepositoryFactory(IDatabaseContext database) { _database = database; }
public PatientsController(IDatabaseContext patientContext) { PatientContext = patientContext; }
public GetAllCategoriesQueryHandler(IDatabaseContext context) { _context = context; }
public async Task <bool> DeleteFromDatabase(IDatabaseContext database) { return(await database.DeleteEntityAsync(Entity)); }
public async Task <bool> UpdateInDatabase(IDatabaseContext database) { Entity.OnUpdateInDatabase(); return(await database.UpdateAsync(Entity)); }
public UserRolRepository(IDatabaseContext database) : base(database) { }
public BackgroundManager(IDatabaseContext context) : base(context) { //maybe do some form of authentication?? }
/// <summary> /// Construct a <see cref="ByondController"/> /// </summary> /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param> /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param> /// <param name="instanceManager">The value of <see cref="instanceManager"/></param> /// <param name="jobManager">The value of <see cref="jobManager"/></param> /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param> public ByondController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, IInstanceManager instanceManager, IJobManager jobManager, ILogger <ByondController> logger) : base(databaseContext, authenticationContextFactory, logger, true) { this.instanceManager = instanceManager ?? throw new ArgumentNullException(nameof(instanceManager)); this.jobManager = jobManager ?? throw new ArgumentNullException(nameof(jobManager)); }
public UserRepository(IDatabaseContext dbContext) : base(dbContext) { }
public StoryRepository(IDatabaseContext context) : base(context) { }
public SOProduceRepository(IDatabaseContext databaseContext) : base(databaseContext) { }
public CompanyService(IDatabaseContext context) { _companyRepository = new CompanyRepository(context); _userRepository = new UserRepository(context); }
public ChannelEventRepository(IDatabaseContext context) { _context = context; }
protected BaseRepository(IDatabaseContext databaseContext) { DatabaseContext = databaseContext; }
public User[] SendNotifications(IDatabaseContext ctx, IEntryWithNames entry, IEnumerable <Artist> artists, IUser creator) { return(new User[0]); }
public ViewSuggestionsQueryHandler(IMapper mapper, IDatabaseContext context) { _context = context; _mapper = mapper; }
private static Dictionary <int, StatsQueries.LocalizedValue> GetSongsWithNamesAndArtists(IDatabaseContext ctx, int[] topSongIds) { var songs = ctx.OfType <Song>().Query() .Where(a => topSongIds.Contains(a.Id)) .Select(a => new StatsQueries.LocalizedValue { Name = new TranslatedString { DefaultLanguage = a.Names.SortNames.DefaultLanguage, English = a.Names.SortNames.English + " (" + a.ArtistString.English + ")", Romaji = a.Names.SortNames.Romaji + " (" + a.ArtistString.Romaji + ")", Japanese = a.Names.SortNames.Japanese + " (" + a.ArtistString.Japanese + ")", }, EntryId = a.Id }).ToDictionary(s => s.EntryId); return(songs); }
public CustomerContactTypeRepository(IDatabaseContext context) { _context = context; }
public AccountManagement(IDatabaseContext context, int personId) : base(context, personId) { }
internal LenderHelper(IDatabaseContext DatabaseConext) : base(DatabaseConext) { }
public FakeRestrictiveAccess(IDatabaseContext context, int personId) : base(context, personId) { }
public ReportService(IDatabaseContext databaseContext) { _db = databaseContext; }
public AutomatedController(IDatabaseContext context) : base(context) { }
public MembershipService(IDatabaseContext databaseContext) { this.databaseContext = databaseContext; }
public HomeController(IDatabaseContext context, AppManager appManager) { this._context = context; this._appManager = appManager; }
public TagFactoryRepository(IDatabaseContext <Tag> ctx, AgentLoginData loginData) { this.ctx = ctx; this.loginData = loginData; }
public IngredienteRepository(IDatabaseContext databaseContext) { _databaseContext = databaseContext; }
protected HelperBase(IDatabaseContext DatabaseContext) { this._databaseContext = DatabaseContext; }
public Repository(IDatabaseContext <TContext> context) { _context = context; _dbConnection = (_context as DbContext).Database.GetDbConnection(); _dbSet = _context.Set <TEntity>(); }
public SequenceTable(IDatabaseContext dbContext, TableInfo tableInfo) : base(dbContext) { this.tableInfo = tableInfo; }
public HomeController(IDatabaseContext databaseContext) { _databaseContext = databaseContext; }
public BuildingsController(IDatabaseContext databaseContext) { _databaseContext = databaseContext; }
public Task <IReadOnlyCollection <User> > SendNotificationsAsync(IDatabaseContext ctx, IEntryWithNames entry, IEnumerable <Artist> artists, IUser creator) { return(Task.FromResult((IReadOnlyCollection <User>) new List <User>())); }