示例#1
0
        /// <summary>
        /// Looks up property names for use with aliases.
        /// </summary>
        /// <param retval="sourcePropery">The source propery.</param>
        /// <returns></returns>
        public IPropertyMappingExpression ForProperty(Expression <Func <T, object> > sourcePropery)
        {
            var propertyName = ReflectionHelper.FindProperty(sourcePropery);
            var typeKey      = typeof(T);

            CheckForPropertyMap(typeKey);
            var expression = new PropertyMappingExpression {
                SourcePropertyName = propertyName
            };

            PropertyMaps[typeKey][propertyName] = expression;
            MongoConfiguration.FireTypeChangedEvent(typeof(T));
            return(expression);
        }
示例#2
0
 /// <summary>
 /// Marks the type as discriminator for all its subtypes.
 /// Alternative to the MongoDiscriminatorAttribute if it is not possible or wanted to put an attribute on the types.
 /// </summary>
 public void UseAsDiscriminator()
 {
     DiscriminatedTypes[typeof(T)] = true;
     MongoConfiguration.FireTypeChangedEvent((typeof(T)));
 }
示例#3
0
 /// <summary>
 /// Uses a connection string for a given type.
 /// </summary>
 /// <param retval="connectionString">The connection string.</param>
 public void UseConnectionString(string connectionString)
 {
     ConnectionStrings[typeof(T)] = connectionString;
     MongoConfiguration.FireTypeChangedEvent(typeof(T));
 }
示例#4
0
 /// <summary>
 /// Uses a retval collection for a given type.
 /// </summary>
 /// <param retval="connectionStrings">The connection strings.</param>
 public void UseCollectionNamed(string connectionStrings)
 {
     CollectionNames[typeof(T)] = connectionStrings;
     MongoConfiguration.FireTypeChangedEvent(typeof(T));
 }