• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CodeDom.CodeAttributeDeclaration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.CodeDom.CodeAttributeDeclaration的典型用法代码示例。如果您正苦于以下问题:C# CodeAttributeDeclaration类的具体用法?C# CodeAttributeDeclaration怎么用?C# CodeAttributeDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CodeAttributeDeclaration类属于System.CodeDom命名空间,在下文中一共展示了CodeAttributeDeclaration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetOneToOneAttributeForTarget

        public CodeAttributeDeclaration GetOneToOneAttributeForTarget()
        {
            CodeAttributeDeclaration attribute = null;

			if (!this.Lazy)
        	{
				attribute = new CodeAttributeDeclaration("OneToOne");

        		if (TargetAccess != PropertyAccess.Property)
        			attribute.Arguments.Add(AttributeHelper.GetNamedEnumAttributeArgument("Access", "PropertyAccess", TargetAccess));
        		if (TargetConstrained)
        			attribute.Arguments.Add(AttributeHelper.GetNamedAttributeArgument("Constrained", TargetConstrained));
        	}
			else
				attribute = new CodeAttributeDeclaration("BelongsTo");

			if (TargetCascade != CascadeEnum.None)
				attribute.Arguments.Add(AttributeHelper.GetNamedEnumAttributeArgument("Cascade", "CascadeEnum", TargetCascade));
			if (!string.IsNullOrEmpty(TargetCustomAccess))
                attribute.Arguments.Add(AttributeHelper.GetNamedAttributeArgument("CustomAccess", TargetCustomAccess));
            if (TargetOuterJoin != OuterJoinEnum.Auto)
                attribute.Arguments.Add(AttributeHelper.GetNamedEnumAttributeArgument("OuterJoin", "OuterJoinEnum", TargetOuterJoin));

            return attribute;
        }
开发者ID:mgagne-atman,项目名称:Projects,代码行数:25,代码来源:OneToOneRelation.cs


示例2: Execute

        public override void Execute(CodeNamespace codeNamespace)
        {
            // foreach datatype in the codeNamespace
            foreach (CodeTypeDeclaration type in codeNamespace.Types)
            {
                if (type.IsEnum) continue;

                foreach (CodeTypeMember member in type.Members)
                {
                    CodeMemberField codeField = member as CodeMemberField;
                    if (codeField == null)
                        continue;

                    // check if the Field is XmlElement
                    //"[System.ComponentModel.TypeConverter(typeof(ByteTypeConverter))]";
                    if (codeField.Type.BaseType == typeof(XmlElement).ToString())
                    {
                        // add the custom type editor attribute
                        CodeAttributeDeclaration attr = new CodeAttributeDeclaration("System.NonSerialized");
                        codeField.CustomAttributes.Add(attr);

                    }
                }

            }
        }
开发者ID:nujmail,项目名称:xsd-to-classes,代码行数:26,代码来源:AddNonSerialized.cs


示例3: AddAttributeDeclaration

        private void AddAttributeDeclaration(CodeTypeDeclaration typeDecl, string clrTypeName, string jsonName)
        {
            if (this.serializationModel == SerializationModel.DataContractJsonSerializer)
            {
                CodeAttributeDeclaration attr = new CodeAttributeDeclaration(
                        new CodeTypeReference(typeof(DataContractAttribute)));
                if (clrTypeName != jsonName)
                {
                    attr.Arguments.Add(new CodeAttributeArgument("Name", new CodePrimitiveExpression(jsonName)));
                }

                typeDecl.CustomAttributes.Add(attr);
            }
            else if (this.serializationModel == SerializationModel.JsonNet)
            {
                typeDecl.CustomAttributes.Add(
                    new CodeAttributeDeclaration(
                        new CodeTypeReference(typeof(JsonObjectAttribute)),
                        new CodeAttributeArgument(
                            "MemberSerialization",
                            new CodeFieldReferenceExpression(
                                new CodeTypeReferenceExpression(typeof(MemberSerialization)),
                                "OptIn"))));
            }
            else
            {
                throw new ArgumentException("Invalid serialization model");
            }
        }
开发者ID:wenrongwu,项目名称:WebAPI,代码行数:29,代码来源:JsonRootCompiler.cs


示例4: SetUp

 public void SetUp()
 {
     Generator = new StructureGenerator(Configuration);
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     attribute = new CodeAttributeDeclaration("MediaType");
     contentType = new MediaType();
 }
开发者ID:KayeeNL,项目名称:Umbraco.CodeGen,代码行数:7,代码来源:StructureGeneratorTests.cs


示例5: BuildPoc

        public CodeTypeDeclaration BuildPoc(TableViewBase rootModel)
        {
            CodeTypeDeclaration ctd = new CodeTypeDeclaration();
            ConstructorGraph ctorGraph = new ConstructorGraph();

            ctd.Name = rootModel.Name;
            ctd.TypeAttributes = System.Reflection.TypeAttributes.Public;
            ctd.Attributes = MemberAttributes.Public;
            ctd.IsPartial = true;
            CodeAttributeDeclaration cad_DataContract = new CodeAttributeDeclaration(" System.Runtime.Serialization.DataContractAttribute");
            ctd.CustomAttributes.Add(cad_DataContract);

            // Members
            foreach (Column c in rootModel.Columns)
            {
                MemberGraph mGraph = new MemberGraph(c);

                CodeMemberField c_field = mGraph.GetField();
                CodeMemberProperty c_prop = mGraph.GetProperty();

                CodeAttributeDeclaration cad_DataMember = new CodeAttributeDeclaration("System.Runtime.Serialization.DataMemberAttribute");
                c_prop.CustomAttributes.Add(cad_DataMember);

                ctd.Members.Add(c_field);
                ctd.Members.Add(c_prop);
            }

            foreach (CodeConstructor cc in ctorGraph.GraphConstructors(rootModel))
            {
                ctd.Members.Add(cc);
            }

            return ctd;
        }
开发者ID:rexwhitten,项目名称:MGenerator,代码行数:34,代码来源:POCOGenerator.cs


示例6: Clone

 //CodeAttributeDeclarationCollection
 //public static CodeAttributeDeclarationCollection Clone(CodeAttributeDeclarationCollection attributeCol) {
 //    foreach(CodeAttributeDeclaration attr in attributeCol) {
 //    }
 //    //CodeDirectiveCollection clone = new CodeDirectiveCollection(directivecol);
 //    //return clone;
 //}
 public static CodeAttributeDeclaration Clone(CodeAttributeDeclaration attributeDecl)
 {
     return new CodeAttributeDeclaration(((CodeTypeReferenceEx)attributeDecl.AttributeType).Clone() as CodeTypeReferenceEx)
     {
         Name = attributeDecl.Name,
     };
 }
开发者ID:RaptorOne,项目名称:SmartDevelop,代码行数:14,代码来源:CloneHelper.cs


示例7: AddCustomAttributesToMethod

 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)) }));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:QueryGenerator.cs


示例8: GetOneToOneAttributeForTarget

        public CodeAttributeDeclaration GetOneToOneAttributeForTarget()
        {
            CodeAttributeDeclaration attribute;

			if (!Lazy)
        	{
				attribute = new CodeAttributeDeclaration("OneToOne");

        		if (TargetConstrained)
        			attribute.Arguments.Add(AttributeHelper.GetNamedAttributeArgument("Constrained", TargetConstrained));
        	}
			else
				attribute = new CodeAttributeDeclaration("BelongsTo");

			if (TargetCascade != CascadeEnum.None)
				attribute.Arguments.Add(AttributeHelper.GetNamedEnumAttributeArgument("Cascade", "CascadeEnum", TargetCascade));

            if (!string.IsNullOrEmpty(TargetCustomAccess))
                attribute.Arguments.Add(AttributeHelper.GetNamedAttributeArgument("CustomAccess", TargetCustomAccess));
            // This was moved out of the above if(Lazy) block.  The properties themselves can be virtual and we can fill in the fields when the NHibernate object is loaded.
            else if (EffectiveTargetAccess != PropertyAccess.Property)
                attribute.Arguments.Add(AttributeHelper.GetNamedEnumAttributeArgument("Access", "PropertyAccess", EffectiveTargetAccess));

            if (TargetOuterJoin != OuterJoinEnum.Auto)
                attribute.Arguments.Add(AttributeHelper.GetNamedEnumAttributeArgument("OuterJoin", "OuterJoinEnum", TargetOuterJoin));

            return attribute;
        }
开发者ID:mgagne-atman,项目名称:Projects,代码行数:28,代码来源:OneToOneRelation.cs


示例9: AddAttribute

		public static void AddAttribute(this CodeAttributeDeclarationCollection codeAttributeDeclarationCollection, CodeAttributeDeclaration codeAttributeDeclaration)
		{
			if (codeAttributeDeclaration != null)
			{
				codeAttributeDeclarationCollection.Add(codeAttributeDeclaration);
			}
		}
开发者ID:Happy-Ferret,项目名称:dotgecko,代码行数:7,代码来源:CodeDomExtensions.cs


示例10: GenerateClassAttributes

    /*
     * Add metadata attributes to the class
     */
    protected override void GenerateClassAttributes() {

        base.GenerateClassAttributes();

        // If the user control has an OutputCache directive, generate
        // an attribute with the information about it.
        if (_sourceDataClass != null && Parser.OutputCacheParameters != null) {
            OutputCacheParameters cacheSettings = Parser.OutputCacheParameters;
            if (cacheSettings.Duration > 0) {
                CodeAttributeDeclaration attribDecl = new CodeAttributeDeclaration(
                    "System.Web.UI.PartialCachingAttribute");
                CodeAttributeArgument attribArg = new CodeAttributeArgument(
                    new CodePrimitiveExpression(cacheSettings.Duration));
                attribDecl.Arguments.Add(attribArg);
                attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(cacheSettings.VaryByParam));
                attribDecl.Arguments.Add(attribArg);
                attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(cacheSettings.VaryByControl));
                attribDecl.Arguments.Add(attribArg);
                attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(cacheSettings.VaryByCustom));
                attribDecl.Arguments.Add(attribArg);
                attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(cacheSettings.SqlDependency));
                attribDecl.Arguments.Add(attribArg);
                attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(Parser.FSharedPartialCaching));
                attribDecl.Arguments.Add(attribArg);
                // Use the providerName argument only when targeting 4.0 and above.
                if (MultiTargetingUtil.IsTargetFramework40OrAbove) {
                    attribArg = new CodeAttributeArgument("ProviderName", new CodePrimitiveExpression(Parser.Provider));
                    attribDecl.Arguments.Add(attribArg);
                }

                _sourceDataClass.CustomAttributes.Add(attribDecl);
            }
        }
    }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:37,代码来源:UserControlCodeDomTreeGenerator.cs


示例11: GetKeyPropertyAttribute

 public CodeAttributeDeclaration GetKeyPropertyAttribute()
 {
     // Why KeyPropertyAttribute doesn't have the same constructor signature as it's base class PropertyAttribute?
     CodeAttributeDeclaration attribute = new CodeAttributeDeclaration("KeyProperty");
     PopulateKeyPropertyAttribute(attribute);
     return attribute;
 }
开发者ID:mgagne-atman,项目名称:Projects,代码行数:7,代码来源:ModelProperty.cs


示例12: GetBelongsToAttribute

        public CodeAttributeDeclaration GetBelongsToAttribute()
        {
            CodeAttributeDeclaration attribute = new CodeAttributeDeclaration("BelongsTo");
            if (!string.IsNullOrEmpty(SourceColumn))
                attribute.Arguments.Add(AttributeHelper.GetPrimitiveAttributeArgument(SourceColumn));
            if (SourceCascade != CascadeEnum.None)
                attribute.Arguments.Add(AttributeHelper.GetNamedEnumAttributeArgument("Cascade", "CascadeEnum", SourceCascade));
            if (!string.IsNullOrEmpty(SourceCustomAccess))
                attribute.Arguments.Add(AttributeHelper.GetNamedAttributeArgument("CustomAccess", SourceCustomAccess));
            if (!SourceInsert)
                attribute.Arguments.Add(AttributeHelper.GetNamedAttributeArgument("Insert", SourceInsert));
            if (SourceNotNull)
                attribute.Arguments.Add(AttributeHelper.GetNamedAttributeArgument("NotNull", SourceNotNull));
            if (SourceOuterJoin != OuterJoinEnum.Auto)
                attribute.Arguments.Add(
                    AttributeHelper.GetNamedEnumAttributeArgument("OuterJoin", "OuterJoinEnum", SourceOuterJoin));
            if (!string.IsNullOrEmpty(SourceType))
                attribute.Arguments.Add(AttributeHelper.GetNamedTypeAttributeArgument("Type", SourceType));
            if (SourceUnique)
                attribute.Arguments.Add(AttributeHelper.GetNamedAttributeArgument("Unique", SourceUnique));
            if (!SourceUpdate)
                attribute.Arguments.Add(AttributeHelper.GetNamedAttributeArgument("Update", SourceUpdate));
            if (SourceNotFoundBehaviour != NotFoundBehaviour.Default)
                attribute.Arguments.Add(AttributeHelper.GetNamedEnumAttributeArgument("NotFoundBehaviour", "NotFoundBehaviour", SourceNotFoundBehaviour));

            return attribute;
        }
开发者ID:mgagne-atman,项目名称:Projects,代码行数:27,代码来源:ManyToOneRelation.cs


示例13: AddAttribute

        public static void AddAttribute(ITypeDefinition cls, string name, params object[] parameters)
        {
            bool isOpen;
            string fileName = cls.Region.FileName;
            var buffer = TextFileProvider.Instance.GetTextEditorData (fileName, out isOpen);

            var attr = new CodeAttributeDeclaration (name);
            foreach (var parameter in parameters) {
                attr.Arguments.Add (new CodeAttributeArgument (new CodePrimitiveExpression (parameter)));
            }

            var type = new CodeTypeDeclaration ("temp");
            type.CustomAttributes.Add (attr);
            Project project;
            if (!cls.TryGetSourceProject (out project)) {
                LoggingService.LogError ("Error can't get source project for:" + cls.FullName);
            }

            var provider = ((DotNetProject)project).LanguageBinding.GetCodeDomProvider ();
            var sw = new StringWriter ();
            provider.GenerateCodeFromType (type, sw, new CodeGeneratorOptions ());
            string code = sw.ToString ();
            int start = code.IndexOf ('[');
            int end = code.LastIndexOf (']');
            code = code.Substring (start, end - start + 1) + Environment.NewLine;

            int pos = buffer.LocationToOffset (cls.Region.BeginLine, cls.Region.BeginColumn);

            code = buffer.GetLineIndent (cls.Region.BeginLine) + code;
            buffer.Insert (pos, code);
            if (!isOpen) {
                File.WriteAllText (fileName, buffer.Text);
                buffer.Dispose ();
            }
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:35,代码来源:CodeGenerationService.cs


示例14: DynaAttributeDeclaration

 public DynaAttributeDeclaration(string AttributeName, object[] AttributeArguements)
 {
     CodeAttributeArgument[] caa = new CodeAttributeArgument[AttributeArguements.Length];
     for (int i = 0; i < caa.Length; i++)
         caa[i] = new CodeAttributeArgument(new CodePrimitiveExpression(AttributeArguements[i]));
     cad = new CodeAttributeDeclaration(AttributeName, caa);
 }
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:7,代码来源:DynaSupplimental.cs


示例15: Execute

        public override void Execute(CodeNamespace codeNamespace)
        {
            if (Options == null || Options.Property == null || Options.Property.Count == 0)
                return;

            // foreach datatype in the codeNamespace
            foreach (CodeTypeDeclaration type in codeNamespace.Types)
            {
                // get a list of the propertytypes that start with the class name
                List<PropertyType> propertyTypes = Options.Property.FindAll(x => x.QualifiedName.StartsWith(type.Name));
                if (propertyTypes == null || propertyTypes.Count == 0)
                    continue;

                foreach (PropertyType propertyType in propertyTypes)
                {
                    CodeMemberProperty member = type
                        .Members
                        .OfType<CodeMemberProperty>()
                        .FirstOrDefault(x => propertyType.QualifiedName.EndsWith(x.Name) || propertyType.QualifiedName.EndsWith("*"));
                    if (member == null)
                        continue;

                    // add the custom type editor attribute
                    CodeAttributeDeclaration attr = new CodeAttributeDeclaration("System.ComponentModel.Browsable");
                    attr.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(false)));
                    member.CustomAttributes.Add(attr);

                }   

            }
        }
开发者ID:nujmail,项目名称:xsd-to-classes,代码行数:31,代码来源:BrowsableProperty.cs


示例16: FormatActions

        private static void FormatActions(AttributableCodeDomObject method, CodeAttributeDeclaration targetAttribute, string serviceNamespace, string serviceName)
        {
            serviceNamespace = serviceNamespace.TrimEnd('/');
            string operationName = method.ExtendedObject.Name;

            CodeAttributeArgument asyncPatternArgument = targetAttribute.FindArgument("AsyncPattern");
            if (asyncPatternArgument != null)
            {
                CodePrimitiveExpression value = asyncPatternArgument.Value as CodePrimitiveExpression;
                if (value != null && (bool)value.Value && operationName.StartsWith("Begin", StringComparison.OrdinalIgnoreCase))
                {
                    operationName = operationName.Substring(5);
                }
            }

            CodeAttributeArgument actionArgument = targetAttribute.FindArgument("Action");
            if (actionArgument != null)
            {
                string action = string.Format("{0}/{1}/{2}", serviceNamespace, serviceName, operationName);
                actionArgument.Value = new CodePrimitiveExpression(action);
            }

            CodeAttributeArgument replyArgument = targetAttribute.FindArgument("ReplyAction");
            if (replyArgument != null)
            {
                string action = string.Format("{0}/{1}/{2}Response", serviceNamespace, serviceName, operationName);
                replyArgument.Value = new CodePrimitiveExpression(action);
            }
        }
开发者ID:WSCF,项目名称:WSCF,代码行数:29,代码来源:ActionDecorator.cs


示例17: OnFieldNameChanged

        protected override void OnFieldNameChanged(CodeTypeMemberExtension memberExtension, string oldName, string newName)
        {
            // Field can be either a body member or a message header.
            // First see if the field is a body member.
            CodeAttributeDeclaration bodyMember = memberExtension.FindAttribute("System.ServiceModel.MessageBodyMemberAttribute");
            // If this is a body member, modify the MessageBodyMemberAttribute to include the wire name.
            if (bodyMember != null)
            {                
                CodeAttributeDeclaration newBodyMember =
                new CodeAttributeDeclaration("System.ServiceModel.MessageBodyMemberAttribute",
                new CodeAttributeArgumentExtended("Name",
                new CodePrimitiveExpression(oldName), true));

                memberExtension.AddAttribute(newBodyMember);                
            }

            // Now check whether the field is a message header.
            CodeAttributeDeclaration header = memberExtension.FindAttribute("System.ServiceModel.MessageHeaderAttribute");
            if (header != null)
            {
                CodeAttributeDeclaration newHeader =
                new CodeAttributeDeclaration("System.ServiceModel.MessageHeaderAttribute",
                new CodeAttributeArgumentExtended("Name",
                new CodePrimitiveExpression(oldName), true));

                memberExtension.AddAttribute(newHeader);                
            }  
            
            // Make sure the field name change is reflected in the field name references.
            ConvertFieldReferencesInConstructors(memberExtension.Parent.Constructors, oldName, newName);
        }
开发者ID:gtri-iead,项目名称:LEXS-NET-Sample-Implementation-3.1.4,代码行数:31,代码来源:MessageContractConverter.cs


示例18: GenerateClassAttributes

 protected override void GenerateClassAttributes()
 {
     base.GenerateClassAttributes();
     if ((base._sourceDataClass != null) && (this.Parser.OutputCacheParameters != null))
     {
         OutputCacheParameters outputCacheParameters = this.Parser.OutputCacheParameters;
         if (outputCacheParameters.Duration > 0)
         {
             CodeAttributeDeclaration declaration = new CodeAttributeDeclaration("System.Web.UI.PartialCachingAttribute");
             CodeAttributeArgument argument = new CodeAttributeArgument(new CodePrimitiveExpression(outputCacheParameters.Duration));
             declaration.Arguments.Add(argument);
             argument = new CodeAttributeArgument(new CodePrimitiveExpression(outputCacheParameters.VaryByParam));
             declaration.Arguments.Add(argument);
             argument = new CodeAttributeArgument(new CodePrimitiveExpression(outputCacheParameters.VaryByControl));
             declaration.Arguments.Add(argument);
             argument = new CodeAttributeArgument(new CodePrimitiveExpression(outputCacheParameters.VaryByCustom));
             declaration.Arguments.Add(argument);
             argument = new CodeAttributeArgument(new CodePrimitiveExpression(outputCacheParameters.SqlDependency));
             declaration.Arguments.Add(argument);
             argument = new CodeAttributeArgument(new CodePrimitiveExpression(this.Parser.FSharedPartialCaching));
             declaration.Arguments.Add(argument);
             if (MultiTargetingUtil.IsTargetFramework40OrAbove)
             {
                 argument = new CodeAttributeArgument("ProviderName", new CodePrimitiveExpression(this.Parser.Provider));
                 declaration.Arguments.Add(argument);
             }
             base._sourceDataClass.CustomAttributes.Add(declaration);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:UserControlCodeDomTreeGenerator.cs


示例19: AddCustomAttributesToMethod

 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)) }));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:FunctionGenerator.cs


示例20: GetGeneratedClass

        private CodeTypeDeclaration GetGeneratedClass(MultiDirectionTestClass testClass)
        {
            CodeTypeDeclaration result = new CodeTypeDeclaration(this.GetGeneratedClassName(testClass));
            result.Attributes = MemberAttributes.Public;
            result.BaseTypes.Add(testClass.ClassType);

            CodeAttributeDeclaration testClassAttribute = new CodeAttributeDeclaration(
                new CodeTypeReference(typeof(TestClassAttribute)));

            result.CustomAttributes.Add(testClassAttribute);

            // Add initialize and cleanup method
            result.Members.Add(this.GetInitCleanupMethod(typeof(ClassInitializeAttribute), testClass));
            result.Members.Add(this.GetInitCleanupMethod(typeof(ClassCleanupAttribute), testClass));

            // No need to generate TestInitialize and TestCleanup Method.
            // Generated class can inherit from base class.

            // Expand multiple direction test case
            foreach (MultiDirectionTestMethod testMethod in testClass.MultiDirectionMethods)
            {
                this.AddGeneratedMethod(result, testMethod);
            }

            return result;
        }
开发者ID:ggais,项目名称:azure-storage-net-data-movement,代码行数:26,代码来源:SourceCodeGenerator.cs



注:本文中的System.CodeDom.CodeAttributeDeclaration类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CodeDom.CodeAttributeDeclarationCollection类代码示例发布时间:2022-05-26
下一篇:
C# CodeDom.CodeAttributeArgument类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap