/// <summary>
 /// Adds a new parameter to the parameter collection.
 /// </summary>
 /// <param name="name">Parameter name</param>
 /// <param name="typeName">Parameter type</param>
 /// <param name="ordinal">Ordinal position within the set of parameters</param>
 /// <returns>A ModelFunctionParameter object</returns>
 public ModelFunctionParameter AddParameter(string name, string typeName, int ordinal)
 {
     try
     {
         if (!Parameters.Where(mp => mp.Name == name).Any())
         {
             ModelFunctionParameter mp = new ModelFunctionParameter(base.ParentFile, this, name, ordinal, _functionImportElement);
             mp.TypeName = typeName;
             _parameters.Add(name, mp);
             mp.NameChanged += new EventHandler <NameChangeArgs>(param_NameChanged);
             mp.Removed     += new EventHandler(param_Removed);
             return(mp);
         }
         else
         {
             throw new ArgumentException("A parameter with the name " + name + " already exist in the function " + this.Name);
         }
     }
     catch (Exception ex)
     {
         try
         {
             ExceptionTools.AddExceptionData(ex, this);
         }
         catch { }
         throw;
     }
 }
示例#2
0
 internal CSDLType(ModelFunctionParameter modelFunctionParameter)
 {
     this.Name = modelFunctionParameter.Name;
     this.CLRTypeName = modelFunctionParameter.TypeName;
     this.MaxLength = modelFunctionParameter.MaxLength;
     this.Nullable = true;// modelMemberProperty.Nullable;
     this.Precision = modelFunctionParameter.Precision;
     this.Scale = modelFunctionParameter.Scale;
     this.FixedLength = false;// modelMemberProperty.FixedLength;
     this.IsUnicode = false;
     this.CompareIsUnicode = false;
 }
示例#3
0
 internal CSDLType(ModelFunctionParameter modelFunctionParameter)
 {
     this.Name             = modelFunctionParameter.Name;
     this.CLRTypeName      = modelFunctionParameter.TypeName;
     this.MaxLength        = modelFunctionParameter.MaxLength;
     this.Nullable         = true;// modelMemberProperty.Nullable;
     this.Precision        = modelFunctionParameter.Precision;
     this.Scale            = modelFunctionParameter.Scale;
     this.FixedLength      = false;// modelMemberProperty.FixedLength;
     this.IsUnicode        = false;
     this.CompareIsUnicode = false;
 }
 /// <summary>
 /// Adds a new parameter to the parameter collection.
 /// </summary>
 /// <param name="name">Parameter name</param>
 /// <param name="typeName">Parameter type</param>
 /// <param name="ordinal">Ordinal position within the set of parameters</param>
 /// <returns>A ModelFunctionParameter object</returns>
 public ModelFunctionParameter AddParameter(string name, string typeName, int ordinal)
 {
     try
     {
         if (!Parameters.Where(mp => mp.Name == name).Any())
         {
             ModelFunctionParameter mp = new ModelFunctionParameter(base.ParentFile, this, name, ordinal, _functionImportElement);
             mp.TypeName = typeName;
             _parameters.Add(name, mp);
             mp.NameChanged += new EventHandler<NameChangeArgs>(param_NameChanged);
             mp.Removed += new EventHandler(param_Removed);
             return mp;
         }
         else
         {
             throw new ArgumentException("A parameter with the name " + name + " already exist in the function " + this.Name);
         }
     }
     catch (Exception ex)
     {
         try
         {
             ExceptionTools.AddExceptionData(ex, this);
         }
         catch { }
         throw;
     }
 }