Ejemplo n.º 1
0
        /// <summary>
        /// Gets the name of the mongo collection configured for the specified type.
        /// </summary>
        /// <typeparam name="TEntity">The type of the entity.</typeparam>
        /// <param name="options">The configuration.</param>
        /// <returns></returns>
        public static string GetCollectionName <TEntity>(this MongoRepositoryOptions options)
        {
            var name = typeof(TEntity).Name;

            if (options.PluralizeCollectionNames)
            {
                name = name.Pluralize();
            }

            switch (options.CollectionNamingConvention)
            {
            case NamingConvention.LowerCase:
                return(name.ToLower());

            case NamingConvention.UpperCase:
                return(name.ToUpper());

            case NamingConvention.Pascal:
                return(name.Pascalize());

            case NamingConvention.Camel:
                return(name.Camelize());

            case NamingConvention.Snake:
                return(name.Underscore());

            default:
                throw new ArgumentOutOfRangeException(nameof(options.CollectionNamingConvention),
                                                      options.CollectionNamingConvention,
                                                      "Unknown collection naming convention");
            }
        }
Ejemplo n.º 2
0
 public MongoLogEventRepository(MongoRepositoryOptions <LogEvent> options)
     : base(options)
 {
 }
Ejemplo n.º 3
0
 public MongoLogTraceRepository(MongoRepositoryOptions <LogTrace> options)
     : base(options)
 {
 }