Esempio n. 1
0
 private string _CreateParamSignature(ParamMetadata paramInfo)
 {
     return string.Format("{0}{1}: {2}{3};", paramInfo.name, paramInfo.isNullable ? "?" : "", (paramInfo.dataType == DataType.None ? this._dotNet2TS.GetTSTypeName(paramInfo.ParameterType) : DotNet2TS.GetTSTypeNameFromDataType(paramInfo.dataType)), (paramInfo.dataType != DataType.None && paramInfo.isArray) ? "[]" : "");
 }
Esempio n. 2
0
 /// <summary>
 /// Extracts from ParameterInfo all information about method parameter
 /// </summary>
 /// <returns>ParamMetadataInfo</returns>
 public static ParamMetadata FromParamInfo(ParameterInfo pinfo, IServiceContainer container)
 {
     Type ptype = pinfo.ParameterType;
     if (pinfo.IsOut)
         throw new DomainServiceException("Out parameters are not supported in service methods");
     ParamMetadata paramInfo = new ParamMetadata();
     paramInfo.isNullable = container.ValueConverter.IsNullableType(ptype);
     paramInfo.name = pinfo.Name;
     paramInfo.ParameterType = ptype;
     Type realType = null;
     if (!paramInfo.isNullable)
         realType = ptype;
     else
         realType = Nullable.GetUnderlyingType(ptype);
     object[] dtops = pinfo.GetCustomAttributes(typeof(DateOptionAttribute), false);
     if (dtops.Length > 0)
     {
         paramInfo.dateConversion = (dtops[0] as DateOptionAttribute).dateConversion;
     }
     bool isArray = false;
     try
     {
         paramInfo.dataType = container.ValueConverter.DataTypeFromType(realType, out isArray);
     }
     catch (UnsupportedTypeException)
     {
         paramInfo.dataType = DataType.None;
     }
     paramInfo.isArray = isArray;
     return paramInfo;
 }