예제 #1
0
 internal static Parameter BuildReturnResultParameter(SchemaProviderBase provider)
 {
     return(new Parameter
     {
         Name = returnResult,
         CamelCaseName = returnResult.ToCamelCase(),
         SqlName = provider.BuildParameterSqlName(returnResult),
         Description = "Return result.",
         EnumType = "global::DbSharper.Library.Data.ReturnResult",
         DbType = DbType.Int32,
         Size = 0,
         Type = "global::System.Int32",
         Direction = ParameterDirection.ReturnValue,
     });
 }
예제 #2
0
        /// <summary>
        /// Transform a model property to a method parameter.
        /// </summary>
        /// <param name="property">Model property.</param>
        /// <param name="isList"></param>
        /// <returns>Method paramter.</returns>
        internal static Parameter PropertyToParameter(SchemaProviderBase provider, Property property, bool isList)
        {
            try
            {
                string name = isList ? property.Name + "List" : property.Name;

                return(new Parameter
                {
                    Name = name,
                    CamelCaseName = name.ToCamelCase(),
                    Description = property.Description,
                    Direction = ParameterDirection.Input,
                    Size = property.Size,
                    DbType = property.DbType,
                    SqlName = provider.BuildParameterSqlName(property.Name),
                    Type = isList ? string.Format(CultureInfo.InvariantCulture, "global::System.Collections.Generic.List<global::System.{0}>", property.Type) : property.Type
                });
            }
            catch (ArgumentException)
            {
                return(null);
            }
        }