/// <summary>
        /// Generates and adds stream related attributes and elements to the entity type
        /// </summary>
        /// <param name="entityType">The entity type's metadata</param>
        /// <param name="entityTypeClass">The entity types declaration</param>
        protected override void GenerateHasStreamEntityTypeCodeElements(EntityType entityType, CodeTypeDeclaration entityTypeClass)
        {
            ExceptionUtilities.Assert(entityType.HasStream(), "This method should not be called for entity types without stream.");
            
            ClientMediaEntryAnnotation clientMediaEntryAnnotation = entityType.Annotations.OfType<ClientMediaEntryAnnotation>().FirstOrDefault();
            if (clientMediaEntryAnnotation != null)
            {
                // generate MediaEntry and MimeTypeProperty properties and attributes for V1 style stream support
                var attributeArguments1 = new CodeAttributeArgument[]
                {
                    new CodeAttributeArgument(Code.Primitive(clientMediaEntryAnnotation.MediaEntryName)),
                };
                var attributeArguments2 = new CodeAttributeArgument[]
                {
                    new CodeAttributeArgument(Code.Primitive(clientMediaEntryAnnotation.MediaEntryName)),
                    new CodeAttributeArgument(Code.Primitive(clientMediaEntryAnnotation.MimeTypePropertyName))
                };

                entityTypeClass.AddCustomAttribute(Code.TypeRef("MediaEntry"), attributeArguments1);
                entityTypeClass.AddCustomAttribute(Code.TypeRef("MimeTypeProperty"), attributeArguments2);
                entityTypeClass.AddAutoImplementedProperty(Code.TypeRef<byte[]>(), clientMediaEntryAnnotation.MediaEntryName);
                entityTypeClass.AddAutoImplementedProperty(Code.TypeRef<string>(), clientMediaEntryAnnotation.MimeTypePropertyName);
            }
            else
            {
                // No ClientMediaEntryAnnotation is found, generate HasStream atttribute for V2 and up stream support
                entityTypeClass.AddCustomAttribute(Code.TypeRef("HasStream"));
            }
        }
 /// <summary>
 /// Generates and adds stream related attributes and elements to the entity type
 /// </summary>
 /// <param name="entityType">The entity type's metadata</param>
 /// <param name="entityTypeClass">The entity types declaration</param>
 protected virtual void GenerateHasStreamEntityTypeCodeElements(EntityType entityType, CodeTypeDeclaration entityTypeClass)
 {
     ExceptionUtilities.Assert(entityType.HasStream(), "This method should not be called for entity types without stream.");
     entityTypeClass.AddCustomAttribute(Code.TypeRef("HasStream"));
 }
        /// <summary>
        /// Generates and adds attribute declarations to the entity type
        /// </summary>
        /// <param name="entityType">The entity type's metadata</param>
        /// <param name="entityTypeClass">The entity types declaration</param>
        protected virtual void GenerateAttributes(EntityType entityType, CodeTypeDeclaration entityTypeClass)
        {
            this.GenerateKeyAttribute(entityType, entityTypeClass);

            foreach (MemberProperty streamProperty in entityType.Properties.Where(p => p.IsStream()))
            {
                this.GenerateNamedStreamAttribute(entityTypeClass, streamProperty);
            }

            if (entityType.HasStream())
            {
                this.GenerateHasStreamEntityTypeCodeElements(entityType, entityTypeClass);
            }
        }