/// <summary> /// Transform entity type properties. /// </summary> /// <param name="entityName">Entity type properties.</param> /// <param name="properties">Entity type properties.</param> /// <returns>Transformed entity type properties.</returns> public List <Dictionary <string, object> > TransformProperties(string entityName, List <Dictionary <string, object> > properties) { var transformedProperties = new List <Dictionary <string, object> >(); foreach (var property in properties) { var propTypeInfo = new EntityPropertyInfo( entityName, property["property-type"] as string, property["property-name"] as string, (property["property-isnullable"] as bool?) == true); var transformedProp = PropertyTransformer?.Invoke(propTypeInfo) ?? propTypeInfo; transformedProperties.Add(new Dictionary <string, object> { { "property-type", transformedProp.PropertyType }, { "property-name", transformedProp.PropertyName }, { "property-annotations", property["property-annotations"] }, { "property-comment", property["property-comment"] }, { "property-isnullable", transformedProp.PropertyIsNullable }, { "nullable-reference-types", property["nullable-reference-types"] } }); } return(transformedProperties); }
/// <summary> /// Transform single property name. /// </summary> /// <param name="propertyName">Property name.</param> /// <returns>Transformed property name.</returns> public string TransformPropertyName(string propertyName) { var propTypeInfo = new EntityPropertyInfo { PropertyName = propertyName }; return(PropertyTransformer?.Invoke(propTypeInfo)?.PropertyName ?? propertyName); }
/// <summary> /// Transform entity type properties. /// </summary> /// <param name="properties">Entity type properties.</param> /// <returns>Transformed entity type properties.</returns> public List <Dictionary <string, object> > TransformProperties(List <Dictionary <string, object> > properties) { var transformedProperties = new List <Dictionary <string, object> >(); foreach (var property in properties) { var propTypeInfo = new EntityPropertyInfo(property["property-type"] as string, property["property-name"] as string); var transformedProp = PropertyTransformer?.Invoke(propTypeInfo) ?? propTypeInfo; transformedProperties.Add(new Dictionary <string, object> { { "property-type", transformedProp.PropertyType }, { "property-name", transformedProp.PropertyName }, { "property-annotations", property["property-annotations"] } }); } return(transformedProperties); }