示例#1
0
        /// <summary>
        /// The method to be called to create the type level attributes for the ItemTypeEmitter
        /// </summary>
        /// <param name="emitter">The strongly typed emitter</param>
        /// <param name="typeDecl">The type declaration to add the attribues to.</param>
        public void EmitTypeAttributes(EntityTypeEmitter emitter, CodeTypeDeclaration typeDecl)
        {
            Debug.Assert(emitter != null, "emitter should not be null");
            Debug.Assert(typeDecl != null, "typeDecl should not be null");

            if (emitter.Generator.Version != DataServiceCodeVersion.V1)
            {
                EmitEpmAttributesForEntityType(emitter.Generator.EdmItemCollection, emitter.Item, typeDecl);
                EmitStreamAttributesForEntityType(emitter.Item, typeDecl);
            }

            object[] keys = emitter.Item.KeyMembers.Select(km => (object)km.Name).ToArray();
            typeDecl.CustomAttributes.Add(EmitSimpleAttribute(Utils.WebFrameworkCommonNamespace + "." + "DataServiceKeyAttribute", keys));
        }
示例#2
0
        /// <summary>
        /// The method to be called to create the type level attributes for the ItemTypeEmitter
        /// </summary>
        /// <param name="emitter">The strongly typed emitter</param>
        /// <param name="typeDecl">The type declaration to add the attribues to.</param>
        public void EmitTypeAttributes(EntityTypeEmitter emitter, CodeTypeDeclaration typeDecl)
        {
            Debug.Assert(emitter != null, "emitter should not be null");
            Debug.Assert(typeDecl != null, "typeDecl should not be null");

            if (emitter.Generator.Version != DataServiceCodeVersion.V1)
            {
                EmitEpmAttributesForEntityType(emitter.Generator.EdmItemCollection, emitter.Item, typeDecl);
                EmitStreamAttributesForEntityType(emitter.Item, typeDecl);
            }

            object[] keys = emitter.Item.KeyMembers.Select(km => (object) km.Name).ToArray();
            typeDecl.CustomAttributes.Add(EmitSimpleAttribute(Utils.WebFrameworkCommonNamespace + "." + "DataServiceKeyAttribute", keys));
        }
        /// <summary>
        /// The method to be called to create the type level attributes for the ItemTypeEmitter
        /// </summary>
        /// <param name="emitter">The strongly typed emitter</param>
        /// <param name="typeDecl">The type declaration to add the attribues to.</param>
        public void EmitTypeAttributes(EntityTypeEmitter emitter, CodeTypeDeclaration typeDecl)
        {
            Debug.Assert(emitter != null, "emitter should not be null");
            Debug.Assert(typeDecl != null, "typeDecl should not be null");

            EmitSchemaTypeAttribute(FQAdoFrameworkDataClassesName("EdmEntityTypeAttribute"), emitter, typeDecl);
            
            CodeAttributeDeclaration attribute2 = EmitSimpleAttribute("System.Runtime.Serialization.DataContractAttribute");
            AttributeEmitter.AddNamedAttributeArguments(attribute2,
                    "IsReference", true);
            typeDecl.CustomAttributes.Add(attribute2);

            CodeAttributeDeclaration attribute3 = EmitSimpleAttribute("System.Serializable");
            typeDecl.CustomAttributes.Add(attribute3);

            EmitKnownTypeAttributes(emitter.Item, emitter.Generator, typeDecl);
        }
示例#4
0
        /// <summary>
        /// The method to be called to create the type level attributes for the ItemTypeEmitter
        /// </summary>
        /// <param name="emitter">The strongly typed emitter</param>
        /// <param name="typeDecl">The type declaration to add the attribues to.</param>
        public void EmitTypeAttributes(EntityTypeEmitter emitter, CodeTypeDeclaration typeDecl)
        {
            Debug.Assert(emitter != null, "emitter should not be null");
            Debug.Assert(typeDecl != null, "typeDecl should not be null");

            EmitSchemaTypeAttribute(FQAdoFrameworkDataClassesName("EdmEntityTypeAttribute"), emitter, typeDecl);

            CodeAttributeDeclaration attribute2 = EmitSimpleAttribute("System.Runtime.Serialization.DataContractAttribute");

            AttributeEmitter.AddNamedAttributeArguments(attribute2,
                                                        "IsReference", true);
            typeDecl.CustomAttributes.Add(attribute2);

            CodeAttributeDeclaration attribute3 = EmitSimpleAttribute("System.Serializable");

            typeDecl.CustomAttributes.Add(attribute3);

            EmitKnownTypeAttributes(emitter.Item, emitter.Generator, typeDecl);
        }