public CollectionViewModel(IDataContextService database, MessageHub hub)
     : base(database, hub)
 {
     CreateCommands();
     RegisterEvents();
     DataBind();
 }
 /// <summary>
 ///     Selects tabs sorted by last time opened
 /// </summary>
 /// <param name="n">Number of tabs taken from the top</param>
 /// <param name="database"> </param>
 public TabsForHistory(int n, IDataContextService database) : base(database)
 {
     Tabs = new ObservableCollection <TabEntity>((from Tab tab in Database.Tabs
                                                  orderby tab.LastOpened descending
                                                  select tab).Where(t => t.LastOpened != null).Take(n).Select(tab => tab.CreateEntity()));
     Initialize();
 }
 public DiscoverViewModel(IDataContextService database, MessageHub hub, IBandSuggestor bandSuggestor)
     : base(database, hub)
 {
     _bandSuggestor = bandSuggestor;
     DataBind();
     CreateCommands();
     RegisterEvents();
 }
示例#4
0
        public TabsForBand(int groupId, IDataContextService database)
            : base(database)
        {
            Tabs = new ObservableCollection <TabEntity>((from Tab tab in Database.Tabs
                                                         orderby tab.Name
                                                         select tab).Where(tab => tab.GroupId == groupId).Select(tab => tab.CreateEntity()));

            Initialize();
        }
 public RelationalDatabase(
     IDataContextService dbContext,
     IRelationalConnection connection,
     IRelationalDatabaseCreator creator)
 {
     _dbContext = dbContext;
     Connection = connection;
     Creator    = creator;
 }
 protected TabViewModelBase(IAudioSearcherFactory audioSearcherFactory, IDataContextService database, PopUpMessageService popUpMessageService, ConfigService configService, MessageHub hub)
     : base(database, hub)
 {
     _audioSearcherFactory = audioSearcherFactory;
     _configService        = configService;
     PopUpMessageService   = popUpMessageService;
     CreateCommands();
     SetConfigVariables();
 }
        protected BaseRepository(ILogger <TModel> logger, IMongoDbUtilities mongoDbUtilities,
                                 IDataContextService <TDataContext> dataContextService,
                                 IValidator <TModel> validator = null)
        {
            _validator = validator ?? new InlineValidator <TModel>();

            CurrentContext = dataContextService.GetDataContext();
            Logger         = logger;
            DbUtilities    = mongoDbUtilities;
        }
 public DataContextViewModel(IDataContextService database, MessageHub hub)
 {
     Database            = database;
     Database.OnChanged += (o, e) =>
     {
         IsRequireBinding = true;
     };
     Hub = hub;
     IsRequireBinding = true;
 }
        public StartupViewModel(IDataContextService database, PopUpMessageService ratingService, ConfigService configService, MessageHub hub)
            : base(database, hub)
        {
            _ratingService = ratingService;
            _configService = configService;

            RegisterEvents();
            CreateCommands();
            SetConfigVariables();
            ProductVersion = App.Version;
        }
示例#10
0
        private void InitializeServices(DataContextOptions options)
        {
            // Each DataContext has it's own set of services and provider.
            _services = new ServiceCollection();

            // Add the services required for the specific relational options.
            options.AddServices(_services);

            _serviceProvider = _services.BuildServiceProvider();

            // Initialize the DbContextService for this context
            _contextService = _serviceProvider.GetRequiredService <IDataContextService>();
            _contextService.Initialize(this);
        }
示例#11
0
 public TabsByName(IDataContextService database, bool createEmpty = false) : base(database)
 {
     if (createEmpty)
     {
         Tabs = new ObservableCollection <TabEntity>();
     }
     else
     {
         Tabs = new ObservableCollection <TabEntity>((from Tab tab in Database.Tabs
                                                      orderby tab.Name
                                                      select tab).Select(tab => tab.CreateEntity()));
     }
     Initialize();
 }
        /// <summary>
        /// Constructs a new Sqlite relational database service.
        /// </summary>
        /// <param name="dbContext">Injected DbContext service which contains a reference to the actual DbContext.</param>
        /// <param name="connection">Injected Sqlite connection service.</param>
        /// <param name="creator">Injected Sqlite database creator service.</param>
        public SqliteRelationalDatabase(
            IDataContextService dbContext,
            IRelationalConnection connection,
            IRelationalDatabaseCreator creator)
            : base(dbContext, connection, creator)
        {
            // The Sqlite database service maintains an open database connection for the lifetime of the DbContext.
            // We use the connection state status to determine if the connection should be closed when the database is disposed.

            Trace.WriteLine("SqliteRelationalDatabase constructor: Opening connection.");

            _wasConnectionOpened = Connection.Open();

            Trace.WriteLine("Connection opened internally is " + _wasConnectionOpened.ToString());
        }
示例#13
0
        public BandByName(IDataContextService database)
        {
            Database = database;

            var allGroups = (from Group g in Database.Groups
                             orderby g.Name
                             select g).ToList();

            _bandGroupsDictionary = new Dictionary <string, BandInGroup>();
            CreateEmptyGroups(_bandGroupsDictionary);


            foreach (Group bandGroup in allGroups)
            {
                //get count of tab for this group
                var count = (from Tab t in Database.Tabs
                             where t.Group.Id == bandGroup.Id
                             select t).Count();

                _bandGroupsDictionary[bandGroup.GetNameKey()].Add(new ObservableTuple <int, Group>
                                                                      (count, bandGroup));
            }
        }
示例#14
0
        protected RelationalConnection(IDataContextService dbContext)
        {
            var options = dbContext.Instance.Options as IRelationalOptions;

            if (options.Connection != null)
            {
                _connection        = options.Connection;
                _isConnectionOwned = false;
            }
            else if (!string.IsNullOrWhiteSpace(options.ConnectionString))
            {
                _connectionString = options.ConnectionString;
                _connection       = CreateDbConnection();

                _isConnectionOwned = true;
            }
            else
            {
                throw new InvalidOperationException(Resources.NoConnectionOrConnectionString);
            }

            _commandTimeout = options.CommandTimeout;
        }
        public GroupViewModel(IMediaSearcherFactory mediaSearcherFactory, ConfigService configService, IDataContextService database, MessageHub hub)
            : base(database, hub)
        {
            _mediaSearcherFactory = mediaSearcherFactory;
            _configService        = configService;

            CreateCommands();
            RegisterEvents();
            SetConfigVariables();
        }
示例#16
0
 public SqliteRelationalConnection(IDataContextService dbContext)
     : base(dbContext)
 {
 }
示例#17
0
 public GenreGroupsViewModel(IGenreBrowser genreBrowser, ConfigService configService, IDataContextService database, MessageHub hub)
     : base(database, hub)
 {
     _genreBrowser  = genreBrowser;
     _configService = configService;
     CreateCommands();
     RegisterEvents();
     SetConfigVariables();
     this.Groups = new ObservableCollection <Group>();
 }
 public PayslipServiceBase(IDataContextService contextService, ILogService logService)
 {
     ContextService    = contextService;
     LogService        = logService;
     TaxServiceFactory = new TaxServiceFactory();
 }
 protected RelationalDatabaseCreator(IDataContextService dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException("dbContext");
 }
 public MonthlyPayslipService(IDataContextService contextService, ILogService logService)
     : base(contextService, logService)
 {
 }
 public TextTabViewModel(IAudioSearcherFactory audioSearcherFactory, IDataContextService database, PopUpMessageService popUpMessageService, ConfigService configService, MessageHub hub)
     : base(audioSearcherFactory, database, popUpMessageService, configService, hub)
 {
     _textTabAdapter = new TextTabAdapter();
 }
 protected GuidBaseRepository(ILogger <TModel> logger, IMongoDbUtilities mongoDbUtilities,
                              IDataContextService <TDataContext> dataContextService,
                              IValidator <TModel> validator = null) : base(logger, mongoDbUtilities, dataContextService, validator)
 {
 }
 public StaveTabViewModel(IAudioSearcherFactory audioSearcherFactory, IDataContextService database, PopUpMessageService popUpService, ConfigService configService, MessageHub hub)
     : base(audioSearcherFactory, database, popUpService, configService, hub)
 {
     CreateCommands();
 }
示例#24
0
 public TabsByName(ObservableCollection <TabEntity> allTabs, IDataContextService database)
     : base(database)
 {
     Tabs = allTabs;
     Initialize();
 }
 public SqliteDatabaseCreator(IDataContextService dbContext, IRelationalConnection connection)
     : base(dbContext)
 {
     _connection = connection as SqliteRelationalConnection;
 }
示例#26
0
 public DataManager(IDataContextService dataContext)
 {
     ProfileRep = new ProfileRepository(dataContext);
 }
示例#27
0
 public UpdateScript(IDataContextService dbService, string dbConnectionString, int dbVersion)
 {
     _dbService          = dbService;
     _dbConnectionString = dbConnectionString;
     _dbVersion          = dbVersion;
 }
 protected TabsGroupsCollection(IDataContextService database)
 {
     Database = database;
 }
        public SearchViewModel(IMediaSearcherFactory mediaSearcherFactory, ITabSearcher tabSearcher, ConfigService configService, IDataContextService database, MessageHub hub)
            : base(database, hub)
        {
            _tabSearcher          = tabSearcher;
            _configService        = configService;
            _mediaSearcherFactory = mediaSearcherFactory;

            CurrentPageIndex  = 1;
            CurrentSearchText = String.Empty;

            HeaderPagingVisibility = Visibility.Collapsed;
            _searchGroupTabs       = new TabsByName(database, true);

            CreateCommands();
            RegisterEvents();
            SetConfigVariables();
        }