Ejemplo n.º 1
0
 public MongoDbContext(MongoDbContextOptions options)
 {
     Initialize(options.DatabaseName,
                new MongoClientOptions()
     {
         Url = options.Url, Settings = options.Settings
     });
 }
        private MongoDbContextOptions BuildOptions(ParameterInfo[] constructorParamsInfo)
        {
            if (DatabaseName == null)
            {
                throw new InvalidOperationException($"Not set {nameof(DatabaseName)} value.");
            }

            var options = new MongoDbContextOptions {
                DatabaseName = DatabaseName
            };

            if (!string.IsNullOrEmpty(this.Url))
            {
                options.Url = new MongoUrlBuilder(Url)
                {
                    DatabaseName = DatabaseName
                }
            }