private PropDefBuilder <T> GetPropDefBuilder(string propertyName) { var propDefBuilder = new PropDefBuilder <T>(CreatePropertiesDefBuilder2()); propDefBuilder.WithPropertyName(propertyName); return(propDefBuilder); }
private void UpdatePropDefCol(string propName, bool isPrimaryKeyProp) { if (!_propDefCol.Contains(propName)) { //set up this property var newPropDefBuilder = new PropDefBuilder <T>(); var propertyInfo = ReflectionUtilities.GetPropertyInfo(typeof(T), propName); if (propertyInfo == null) { newPropDefBuilder.WithPropertyName(propName); if (isPrimaryKeyProp) { newPropDefBuilder.WithType(typeof(Guid)); } } else { Type propertyType = ReflectionUtilities.GetUndelyingPropertType(propertyInfo); newPropDefBuilder.WithPropertyName(propertyInfo.Name); newPropDefBuilder.WithType(propertyType); } if (isPrimaryKeyProp) { newPropDefBuilder.WithReadWriteRule(PropReadWriteRule.WriteNew); } var pkPropDef = newPropDefBuilder.Build(); _propDefCol.Add(pkPropDef); } }
public PropDefBuilder <T> Property <TReturnType>(Expression <Func <T, TReturnType> > propExpression) { var propDefBuilder = new PropDefBuilder <T>(CreatePropertiesDefBuilder2()); PropertyInfo propertyInfo = GetPropertyInfo(propExpression); propDefBuilder.WithPropertyName(propertyInfo.Name); Type propertyType = ReflectionUtilities.GetUndelyingPropertType(propertyInfo); propDefBuilder.WithAssemblyName(propertyType.Namespace); propDefBuilder.WithTypeName(propertyType.Name); PropDefBuilders.Add(propDefBuilder); return(propDefBuilder); }