private void AddParametersToMethod(CodeMemberMethod dbMethod) { CodeParameterDeclarationExpression expression = null; if (base.activeCommand.Parameters != null) { DesignConnection connection = (DesignConnection)base.methodSource.Connection; if (connection == null) { throw new InternalException("Connection for query '" + base.methodSource.Name + "' is null."); } string parameterPrefix = connection.ParameterPrefix; foreach (DesignParameter parameter in base.activeCommand.Parameters) { if (parameter.Direction != ParameterDirection.ReturnValue) { Type parameterUrtType = base.GetParameterUrtType(parameter); string name = base.nameHandler.AddParameterNameToList(parameter.ParameterName, parameterPrefix); CodeTypeReference type = null; if (parameter.AllowDbNull && parameterUrtType.IsValueType) { type = CodeGenHelper.NullableType(parameterUrtType); } else { type = CodeGenHelper.Type(parameterUrtType); } expression = CodeGenHelper.ParameterDecl(type, name); expression.Direction = CodeGenHelper.ParameterDirectionToFieldDirection(parameter.Direction); dbMethod.Parameters.Add(expression); } } } }
private void AddParametersToMethod(CodeMemberMethod dbMethod) { DesignConnection connection = (DesignConnection)base.methodSource.Connection; if (connection == null) { throw new InternalException(string.Format(CultureInfo.CurrentCulture, "Connection for query {0} is null.", new object[] { base.methodSource.Name })); } string parameterPrefix = connection.ParameterPrefix; if (base.MethodType == MethodTypeEnum.ColumnParameters) { if (base.activeCommand.Parameters != null) { CodeParameterDeclarationExpression expression = null; foreach (DesignParameter parameter in base.activeCommand.Parameters) { if (((parameter.Direction != ParameterDirection.ReturnValue) && !parameter.SourceColumnNullMapping) && ((!this.GenerateOverloadWithoutCurrentPKParameters || (parameter.SourceVersion != DataRowVersion.Current)) || (!this.IsPrimaryColumn(parameter.SourceColumn) || (this.GetOriginalVersionParameter(parameter) == null)))) { Type parameterUrtType = base.GetParameterUrtType(parameter); string name = base.nameHandler.AddParameterNameToList(parameter.ParameterName, parameterPrefix); CodeTypeReference type = null; if (parameter.AllowDbNull && parameterUrtType.IsValueType) { type = CodeGenHelper.NullableType(parameterUrtType); } else { type = CodeGenHelper.Type(parameterUrtType); } expression = CodeGenHelper.ParameterDecl(type, name); expression.Direction = CodeGenHelper.ParameterDirectionToFieldDirection(parameter.Direction); dbMethod.Parameters.Add(expression); } } } } else { CodeParameterDeclarationExpression expression2 = null; string str3 = base.nameHandler.AddParameterNameToList(base.UpdateParameterName, parameterPrefix); if (base.UpdateParameterTypeName != null) { expression2 = CodeGenHelper.ParameterDecl(CodeGenHelper.Type(base.UpdateParameterTypeName), str3); } else { expression2 = CodeGenHelper.ParameterDecl(base.UpdateParameterTypeReference, str3); } dbMethod.Parameters.Add(expression2); } }
private void AddParametersToMethod(CodeMemberMethod dbMethod) { CodeParameterDeclarationExpression expression = null; if (!base.getMethod) { string name = base.nameHandler.AddNameToList(base.ContainerParameterName); expression = CodeGenHelper.ParameterDecl(CodeGenHelper.Type(base.ContainerParameterTypeName), name); dbMethod.Parameters.Add(expression); } if (base.GeneratePagingMethod) { string str2 = base.nameHandler.AddNameToList(QueryGeneratorBase.startRecordParameterName); expression = CodeGenHelper.ParameterDecl(CodeGenHelper.GlobalType(typeof(int)), str2); dbMethod.Parameters.Add(expression); string str3 = base.nameHandler.AddNameToList(QueryGeneratorBase.maxRecordsParameterName); expression = CodeGenHelper.ParameterDecl(CodeGenHelper.GlobalType(typeof(int)), str3); dbMethod.Parameters.Add(expression); } if (base.activeCommand.Parameters != null) { DesignConnection connection = (DesignConnection)base.methodSource.Connection; if (connection == null) { throw new InternalException(string.Format(CultureInfo.CurrentCulture, "Connection for query {0} is null.", new object[] { base.methodSource.Name })); } string parameterPrefix = connection.ParameterPrefix; foreach (DesignParameter parameter in base.activeCommand.Parameters) { if (parameter.Direction != ParameterDirection.ReturnValue) { Type parameterUrtType = base.GetParameterUrtType(parameter); string str5 = base.nameHandler.AddParameterNameToList(parameter.ParameterName, parameterPrefix); CodeTypeReference type = null; if (parameter.AllowDbNull && parameterUrtType.IsValueType) { type = CodeGenHelper.NullableType(parameterUrtType); } else { type = CodeGenHelper.Type(parameterUrtType); } expression = CodeGenHelper.ParameterDecl(type, str5); expression.Direction = CodeGenHelper.ParameterDirectionToFieldDirection(parameter.Direction); dbMethod.Parameters.Add(expression); } } } }
public object Clone() { DesignConnection connection = new DesignConnection { Name = this.name }; if (this.ConnectionStringObject != null) { connection.ConnectionStringObject = (System.Data.Design.ConnectionString) ((ICloneable) this.ConnectionStringObject).Clone(); } connection.provider = this.provider; connection.isAppSettingsProperty = this.isAppSettingsProperty; connection.propertyReference = this.propertyReference; connection.properties = (HybridDictionary) DesignUtil.CloneDictionary(this.properties); return connection; }
public object Clone() { DesignConnection connection = new DesignConnection { Name = this.name }; if (this.ConnectionStringObject != null) { connection.ConnectionStringObject = (System.Data.Design.ConnectionString)((ICloneable)this.ConnectionStringObject).Clone(); } connection.provider = this.provider; connection.isAppSettingsProperty = this.isAppSettingsProperty; connection.propertyReference = this.propertyReference; connection.properties = (HybridDictionary)DesignUtil.CloneDictionary(this.properties); return(connection); }