private void AddCustomAttributesToMethod(CodeMemberMethod dbMethod) { bool primitive = false; DataObjectMethodType fill = DataObjectMethodType.Fill; if (base.methodSource.EnableWebMethods && base.getMethod) { CodeAttributeDeclaration declaration = new CodeAttributeDeclaration("System.Web.Services.WebMethod"); declaration.Arguments.Add(new CodeAttributeArgument("Description", CodeGenHelper.Str(base.methodSource.WebMethodDescription))); dbMethod.CustomAttributes.Add(declaration); } if (!base.GeneratePagingMethod && (base.getMethod || (base.ContainerParameterType == typeof(DataTable)))) { if (base.MethodSource == base.DesignTable.MainSource) { primitive = true; } if (base.getMethod) { fill = DataObjectMethodType.Select; } else { fill = DataObjectMethodType.Fill; } dbMethod.CustomAttributes.Add(new CodeAttributeDeclaration(CodeGenHelper.GlobalType(typeof(DataObjectMethodAttribute)), new CodeAttributeArgument[] { new CodeAttributeArgument(CodeGenHelper.Field(CodeGenHelper.GlobalTypeExpr(typeof(DataObjectMethodType)), fill.ToString())), new CodeAttributeArgument(CodeGenHelper.Primitive(primitive)) })); } }
private void AddCustomAttributesToMethod(CodeMemberMethod dbMethod) { DataObjectMethodType update = DataObjectMethodType.Update; if (base.methodSource.EnableWebMethods) { CodeAttributeDeclaration declaration = new CodeAttributeDeclaration("System.Web.Services.WebMethod"); declaration.Arguments.Add(new CodeAttributeArgument("Description", CodeGenHelper.Str(base.methodSource.WebMethodDescription))); dbMethod.CustomAttributes.Add(declaration); } if (base.MethodType != MethodTypeEnum.GenericUpdate) { if (base.activeCommand == base.methodSource.DeleteCommand) { update = DataObjectMethodType.Delete; } else if (base.activeCommand == base.methodSource.InsertCommand) { update = DataObjectMethodType.Insert; } else if (base.activeCommand == base.methodSource.UpdateCommand) { update = DataObjectMethodType.Update; } dbMethod.CustomAttributes.Add(new CodeAttributeDeclaration(CodeGenHelper.GlobalType(typeof(DataObjectMethodAttribute)), new CodeAttributeArgument[] { new CodeAttributeArgument(CodeGenHelper.Field(CodeGenHelper.GlobalTypeExpr(typeof(DataObjectMethodType)), update.ToString())), new CodeAttributeArgument(CodeGenHelper.Primitive(true)) })); } }
private void AddCustomAttributesToMethod(CodeMemberMethod dbMethod) { if (base.methodSource.EnableWebMethods) { CodeAttributeDeclaration declaration = new CodeAttributeDeclaration("System.Web.Services.WebMethod"); declaration.Arguments.Add(new CodeAttributeArgument("Description", CodeGenHelper.Str(base.methodSource.WebMethodDescription))); dbMethod.CustomAttributes.Add(declaration); } DataObjectMethodType select = DataObjectMethodType.Select; if (base.methodSource.CommandOperation == CommandOperation.Update) { select = DataObjectMethodType.Update; } else if (base.methodSource.CommandOperation == CommandOperation.Delete) { select = DataObjectMethodType.Delete; } else if (base.methodSource.CommandOperation == CommandOperation.Insert) { select = DataObjectMethodType.Insert; } if (select != DataObjectMethodType.Select) { dbMethod.CustomAttributes.Add(new CodeAttributeDeclaration(CodeGenHelper.GlobalType(typeof(DataObjectMethodAttribute)), new CodeAttributeArgument[] { new CodeAttributeArgument(CodeGenHelper.Field(CodeGenHelper.GlobalTypeExpr(typeof(DataObjectMethodType)), select.ToString())), new CodeAttributeArgument(CodeGenHelper.Primitive(false)) })); } }