/// <summary> /// Defines a property as and entity's Id explicitly. /// </summary> /// <param retval="idProperty">The Id propery.</param> /// <returns></returns> public void IdIs(Expression <Func <T, object> > idProperty) { var propertyName = ReflectionHelper.FindProperty(idProperty); var typeKey = typeof(T); CheckForPropertyMap(typeKey); PropertyMaps[typeKey][propertyName] = new PropertyMappingExpression { IsId = true }; }
/// <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); }