public IComplexPropertyBuilder <TProperty, TEntity> HasOne <TProperty>(Expression <Func <TEntity, TProperty> > property) { string propertyName = PropertyNameExtractor.Extract(property); IComplexPropertyBuilder <TProperty, TEntity> propertyBuilder = this.HasOne(propertyName) as IComplexPropertyBuilder <TProperty, TEntity>; return(propertyBuilder); }
public IComplexPropertyBuilder HasOne(string property) { ComplexProperty complexProperty = this.EntityType.ComplexProperties.Where(a => a.Property.Name == property).FirstOrDefault(); if (complexProperty == null) { PropertyInfo propertyInfo = this.GetEntityProperty(property); complexProperty = new ComplexProperty(propertyInfo); this.EntityType.ComplexProperties.Add(complexProperty); } IComplexPropertyBuilder propertyBuilder = Activator.CreateInstance(typeof(ComplexPropertyBuilder <,>).MakeGenericType(complexProperty.Property.PropertyType, typeof(TEntity)), complexProperty) as IComplexPropertyBuilder; return(propertyBuilder); }