Exemplo n.º 1
0
        // I did barf a little when writing this thanks for asking.

        public static IDoubleKeyRepository <TValue> Create <TValue> (string table, string typeString)
        {
            string group = Database.GetDatabaseGroup(typeString);
            string type  = Database.GetDatabaseType(typeString);

            if (!_repos.ContainsKey(group))
            {
                throw new NotImplementedException($"The double key repository group '{group} is not supported.");
            }

            IDoubleKeyRepository <TValue> repo = null;
            Type groupType = _repos[group].MakeGenericType(typeof(TValue));

            repo = Activator.CreateInstance(groupType, table, _factories[group].Create(type)) as IDoubleKeyRepository <TValue>;

            repo.Init();
            return(repo);
        }
Exemplo n.º 2
0
 public DoubleKeyJsonRepository(string sourceTable)
 {
     _dataRepo = Factories.DoubleKeyRepositoryFactory.Create <string, string, string> (sourceTable);
     _dataRepo.Init();
 }