/// <summary>
 /// Converts a <see cref="PropertyInfo"/> into a mapped name.
 /// </summary>
 /// <param name="property">The instance of the property to be converted.</param>
 /// <param name="dbSetting">The currently in used <see cref="IDbSetting"/> object.</param>
 /// <returns>A instance of string containing the value of a mapped name.</returns>
 internal static string AsFieldAsString(this PropertyInfo property,
                                        IDbSetting dbSetting) =>
 PropertyMappedNameCache.Get(property).AsQuoted(true, dbSetting);
 /// <summary>
 /// Converts a <see cref="PropertyInfo"/> into a parameterized name.
 /// </summary>
 /// <param name="property">The instance of the property to be converted.</param>
 /// <param name="dbSetting">The currently in used <see cref="IDbSetting"/> object.</param>
 /// <returns>A instance of string containing the value of a parameterized name.</returns>
 internal static string AsParameterAsString(this PropertyInfo property,
                                            IDbSetting dbSetting) =>
 string.Concat(dbSetting.ParameterPrefix, PropertyMappedNameCache.Get(property));
 /// <summary>
 /// Converts an instance of <see cref="PropertyInfo"/> object into <see cref="Field"/> object.
 /// </summary>
 /// <param name="property">The instance of <see cref="PropertyInfo"/> object to be converted.</param>
 /// <returns>The converted instance of <see cref="Field"/> object.</returns>
 public static Field AsField(this PropertyInfo property) =>
 new Field(PropertyMappedNameCache.Get(property), property.PropertyType.GetUnderlyingType());
Esempio n. 4
0
 /// <summary>
 /// Converts a property info into a paramertized name.
 /// </summary>
 /// <param name="property">The instance of the property to be converted.</param>
 /// <returns>A instance of string containing the value of a parameterized name.</returns>
 public static string AsParameter(this PropertyInfo property)
 {
     return(string.Concat("@", PropertyMappedNameCache.Get(property)));
 }
Esempio n. 5
0
 /// <summary>
 /// Gets the name of the current instance of <see cref="MemberInfo"/>. If the instance is <see cref="PropertyInfo"/>, it will try to retrieved the
 /// mapped name of the property.
 /// </summary>
 /// <param name="member">The member where to retrieve a name.</param>
 /// <returns>The name of the <see cref="MemberInfo"/>.</returns>
 internal static string GetMappedName(this MemberInfo member) =>
 member.IsPropertyInfo() ? PropertyMappedNameCache.Get(member.ToPropertyInfo()) : member.Name;
Esempio n. 6
0
 /// <summary>
 /// Converts a property info into a string qualifier with defined aliases that is usable for SQL Statements.
 /// </summary>
 /// <param name="property">The property info to be converted.</param>
 /// <param name="leftAlias">The left alias to be used.</param>
 /// <param name="rightAlias">The right alias to be used.</param>
 /// <returns>A instance of string containing the value of converted property info with defined aliases.</returns>
 public static string AsJoinQualifier(this PropertyInfo property, string leftAlias, string rightAlias)
 {
     return(string.Concat(leftAlias, ".", PropertyMappedNameCache.Get(property).AsQuoted(), " = ", rightAlias, ".", PropertyMappedNameCache.Get(property).AsQuoted()));
 }
Esempio n. 7
0
 /// <summary>
 /// Converts a property info into a mapped name.
 /// </summary>
 /// <param name="property">The instance of the property to be converted.</param>
 /// <returns>A instance of string containing the value of a mapped name.</returns>
 public static string AsField(this PropertyInfo property)
 {
     return(PropertyMappedNameCache.Get(property).AsQuoted());
 }
Esempio n. 8
0
 /// <summary>
 /// Converts a property info into a query field object.
 /// </summary>
 /// <param name="property">The instance of property info to be converted.</param>
 /// <param name="entity">The entity object where the value of the property will be retrieved.</param>
 /// <returns>An instance of query field object that holds the converted name and values of the property.</returns>
 /// <param name="appendParameterPrefix">
 /// The value to identify whether the underscope prefix will be appended to the parameter name.
 /// </param>
 internal static QueryField AsQueryField(this PropertyInfo property, object entity, bool appendParameterPrefix)
 {
     return(new QueryField(PropertyMappedNameCache.Get(property), Operation.Equal, property.GetValue(entity), appendParameterPrefix));
 }
Esempio n. 9
0
 /// <summary>
 /// Converts an instance of <see cref="PropertyInfo"/> object into <see cref="Field"/> object.
 /// </summary>
 /// <param name="property">The instance of <see cref="PropertyInfo"/> object to be converted.</param>
 /// <returns>The converted instance of <see cref="Field"/> object.</returns>
 public static Field AsField(this PropertyInfo property)
 {
     return(new Field(PropertyMappedNameCache.Get(property, false), property.PropertyType.GetUnderlyingType()));
 }
Esempio n. 10
0
 /// <summary>
 /// Converts a <see cref="PropertyInfo"/> into a parameterized name.
 /// </summary>
 /// <param name="property">The instance of the property to be converted.</param>
 /// <returns>A instance of string containing the value of a parameterized name.</returns>
 internal static string AsParameterAsString(this PropertyInfo property)
 {
     return(string.Concat("@", PropertyMappedNameCache.Get(property, false)));
 }
Esempio n. 11
0
 /// <summary>
 /// Converts a <see cref="PropertyInfo"/> into a mapped name.
 /// </summary>
 /// <param name="property">The instance of the property to be converted.</param>
 /// <param name="quoted">True whether the string is quoted.</param>
 /// <returns>A instance of string containing the value of a mapped name.</returns>
 internal static string AsFieldAsString(this PropertyInfo property, bool quoted = true)
 {
     return(PropertyMappedNameCache.Get(property, quoted));
 }
Esempio n. 12
0
 /// <summary>
 /// Converts a <see cref="PropertyInfo"/> into a query field object.
 /// </summary>
 /// <param name="property">The instance of <see cref="PropertyInfo"/> to be converted.</param>
 /// <param name="entity">The entity object where the value of the property will be retrieved.</param>
 /// <returns>An instance of query field object that holds the converted name and values of the property.</returns>
 /// <param name="appendUnderscore">
 /// The value to identify whether the underscope prefix will be appended to the parameter name.
 /// </param>
 internal static QueryField AsQueryField(this PropertyInfo property, object entity, bool appendUnderscore)
 {
     return(new QueryField(new Field(PropertyMappedNameCache.Get(property), property.PropertyType.GetUnderlyingType()),
                           Operation.Equal, property.GetValue(entity), appendUnderscore));
 }