public DonutContext(IRedisCacher cacher, Data.DataIntegration integration, IServiceProvider serviceProvider) { _cacher = cacher; ApiAuth = integration.APIKey; CacheRunInterval = 10; _currentCacheRunIndex = 0; Integration = integration; CurrentCache = new ConcurrentDictionary <string, List <HashEntry> >(); ConfigureCacheMap(); Prefix = $"integration_context:{Integration.Id}"; new ContextSetDiscoveryService(this, serviceProvider).Initialize(); _cachingService = new CachingPersistŠµnceService(this); if (integration != null && !string.IsNullOrEmpty(integration.FeaturesCollection)) { _encoder = FieldEncoder.Factory.Create(Integration); // var dbConfig = DBConfig.GetGeneralDatabase(); // var mongoList = new MongoList(dbConfig, integration.FeaturesCollection);//Make sure the collection exists // var murlBuilder = new MongoUrlBuilder(""); // murlBuilder.AuthenticationSource = "admin"; // var murl = murlBuilder.ToMongoUrl(); // var connection = new MongoClient(murl); // var database = connection.GetDatabase(""); //IMongoDatabase db = MongoHelper.GetDatabase(); //db.CreateCollection(integration.FeaturesCollection); } }
public DonutBuilder(DataIntegration integration, IRedisCacher cacher, IServiceProvider serviceProvider) { _tContext = typeof(TContext); _serviceProvider = serviceProvider; var assembly = Assembly.GetExecutingAssembly(); var resourceName = "Donut.Lex.Templates.Donutfile.txt"; _cacher = cacher; _integration = integration; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) { _template = reader.ReadToEnd(); } }