/// <summary> /// Adds a parameter to the function definition. /// </summary> /// <param name="name">Parameter name</param> /// <param name="dataType">Data type</param> /// <param name="ordinal">Ordinal position in relation to other parameters. (Zero-based)</param> /// <returns>A StoreFunctionParameter object.</returns> public StoreFunctionParameter AddParameter(string name, string dataType, int ordinal) { try { if (!Parameters.Where(mp => mp.Name == name).Any()) { StoreFunctionParameter mp = new StoreFunctionParameter(base.ParentFile, this, name, ordinal, _functionElement); mp.DataType = dataType; _parameters.Add(name, mp); mp.NameChanged += new EventHandler <NameChangeArgs>(prop_NameChanged); mp.Removed += new EventHandler(prop_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; } }
internal CSDLType(StoreFunctionParameter storeFunctionParameter) { this.Name = storeFunctionParameter.Name; bool isUnicode = false; this.CLRTypeName = CSDLTypeNameFromSSDLTypeName(storeFunctionParameter.DataType, out isUnicode); this.IsUnicode = isUnicode; this.MaxLength = storeFunctionParameter.MaxLength; this.Nullable = true; this.Precision = storeFunctionParameter.Precision; this.Scale = storeFunctionParameter.Scale; this.FixedLength = storeFunctionParameter.FixedLength; this.CompareIsUnicode = true; }
/// <summary> /// Adds a parameter to the function definition. /// </summary> /// <param name="name">Parameter name</param> /// <param name="dataType">Data type</param> /// <param name="ordinal">Ordinal position in relation to other parameters. (Zero-based)</param> /// <returns>A StoreFunctionParameter object.</returns> public StoreFunctionParameter AddParameter(string name, string dataType, int ordinal) { try { if (!Parameters.Where(mp => mp.Name == name).Any()) { StoreFunctionParameter mp = new StoreFunctionParameter(base.ParentFile, this, name, ordinal, _functionElement); mp.DataType = dataType; _parameters.Add(name, mp); mp.NameChanged += new EventHandler<NameChangeArgs>(prop_NameChanged); mp.Removed += new EventHandler(prop_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; } }