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

C# BaseAttribute类代码示例

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

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



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

示例1: WriteComponentProperty

        public virtual void WriteComponentProperty(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, ComponentPropertyAttribute attrib, BaseAttribute parentAttribute)
        {
            System.Type componentType = attrib.ComponentType;
            if(componentType == null)
                if(member is System.Reflection.FieldInfo)
                    componentType = (member as System.Reflection.FieldInfo).FieldType;
                else // It MUST be a PropertyInfo
                    componentType = (member as System.Reflection.PropertyInfo).PropertyType;

            object[] componentAttributes = componentType.GetCustomAttributes(typeof(ComponentAttribute), false);
            if(componentAttributes.Length == 0)
                throw new MappingException(componentType.FullName + " doesn't have the attribute [Component]!");
            ComponentAttribute componentAttribute = componentAttributes[0] as ComponentAttribute;

            string componentName = attrib.PropertyName;
            if(componentName == null)
                componentName = member.Name; // Default value

            if(componentAttribute.Name != null && componentAttribute.Name != componentName)
                // Because, it will be used by the default implementation of "WriteComponent()"
                throw new MappingException(componentType.FullName + " must have a [Component] with a 'null' Name (or the name '" + componentName + "')");

            // Get the helper to set the componentName
            HbmWriterHelperEx helper = this.DefaultHelper as HbmWriterHelperEx;
            if(helper == null)
                throw new MappingException("DefaultHelper must be a HbmWriterHelperEx (or a subType) to use [ComponentProperty]");

            // Set the value that will be returned when WriteComponent() will call Get_Component_Name_DefaultValue()
            string savedValue = helper.DefaultValue;
            helper.DefaultValue = componentName;
            try
            {
                WriteComponent(writer, componentType);
            }
            finally
            {
                helper.DefaultValue = savedValue;
            }
        }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:39,代码来源:HbmWriterEx.cs


示例2: WriteGenerator

        /// <summary> Write a Generator XML Element from attributes in a member. </summary>
        public virtual void WriteGenerator(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, GeneratorAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "generator" );
            // Attribute: <class>
            writer.WriteAttributeString("class", attribute.Class==null ? DefaultHelper.Get_Generator_Class_DefaultValue(member) : GetAttributeValue(attribute.Class, mappedClass));

            WriteUserDefinedContent(writer, member, null, attribute);

            System.Collections.ArrayList memberAttribs = GetSortedAttributes(member);
            int attribPos; // Find the position of the GeneratorAttribute (its <sub-element>s must be after it)
            for(attribPos=0; attribPos<memberAttribs.Count; attribPos++)
                if( memberAttribs[attribPos] is GeneratorAttribute
                    && ((BaseAttribute)memberAttribs[attribPos]).Position == attribute.Position )
                    break; // found
            int i = attribPos + 1;

            // Element: <param>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ParamAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is GeneratorAttribute )
                        break; // Following attributes are for this Generator
                    if( memberAttrib is ParamAttribute )
                        WriteParam(writer, member, memberAttrib as ParamAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(ParamAttribute), attribute);

            writer.WriteEndElement();
        }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:36,代码来源:HbmWriter.cs


示例3: WriteSqlQuery

        /// <summary> Write a SqlQuery XML Element from attributes in a member. </summary>
        public virtual void WriteSqlQuery(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, SqlQueryAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "sql-query" );
            // Attribute: <name>
            writer.WriteAttributeString("name", attribute.Name==null ? DefaultHelper.Get_SqlQuery_Name_DefaultValue(member) : GetAttributeValue(attribute.Name, mappedClass));
            // Attribute: <resultset-ref>
            if(attribute.ResultSetRef != null)
            writer.WriteAttributeString("resultset-ref", GetAttributeValue(attribute.ResultSetRef, mappedClass));
            // Attribute: <flush-mode>
            if(attribute.FlushMode != FlushMode.Unspecified)
            writer.WriteAttributeString("flush-mode", GetXmlEnumValue(typeof(FlushMode), attribute.FlushMode));
            // Attribute: <cacheable>
            if( attribute.CacheableSpecified )
            writer.WriteAttributeString("cacheable", attribute.Cacheable ? "true" : "false");
            // Attribute: <cache-region>
            if(attribute.CacheRegion != null)
            writer.WriteAttributeString("cache-region", GetAttributeValue(attribute.CacheRegion, mappedClass));
            // Attribute: <fetch-size>
            if(attribute.FetchSize != -9223372036854775808)
            writer.WriteAttributeString("fetch-size", attribute.FetchSize.ToString());
            // Attribute: <timeout>
            if(attribute.Timeout != -1)
            writer.WriteAttributeString("timeout", attribute.Timeout.ToString());
            // Attribute: <cache-mode>
            if(attribute.CacheMode != CacheMode.Unspecified)
            writer.WriteAttributeString("cache-mode", GetXmlEnumValue(typeof(CacheMode), attribute.CacheMode));
            // Attribute: <read-only>
            if( attribute.ReadOnlySpecified )
            writer.WriteAttributeString("read-only", attribute.ReadOnly ? "true" : "false");
            // Attribute: <comment>
            if(attribute.Comment != null)
            writer.WriteAttributeString("comment", GetAttributeValue(attribute.Comment, mappedClass));
            // Attribute: <callable>
            if( attribute.CallableSpecified )
            writer.WriteAttributeString("callable", attribute.Callable ? "true" : "false");

            WriteUserDefinedContent(writer, member, null, attribute);

            // Write the content of this element (mixed="true")
            writer.WriteString(attribute.Content);

            writer.WriteEndElement();
        }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:44,代码来源:HbmWriter.cs


示例4: WriteReturnScalar

        /// <summary> Write a ReturnScalar XML Element from attributes in a member. </summary>
        public virtual void WriteReturnScalar(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, ReturnScalarAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "return-scalar" );
            // Attribute: <column>
            writer.WriteAttributeString("column", attribute.Column==null ? DefaultHelper.Get_ReturnScalar_Column_DefaultValue(member) : GetAttributeValue(attribute.Column, mappedClass));
            // Attribute: <type>
            if(attribute.Type != null)
            writer.WriteAttributeString("type", GetAttributeValue(attribute.Type, mappedClass));

            WriteUserDefinedContent(writer, member, null, attribute);

            writer.WriteEndElement();
        }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:14,代码来源:HbmWriter.cs


示例5: WriteReturnJoin

        /// <summary> Write a ReturnJoin XML Element from attributes in a member. </summary>
        public virtual void WriteReturnJoin(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, ReturnJoinAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "return-join" );
            // Attribute: <alias>
            writer.WriteAttributeString("alias", attribute.Alias==null ? DefaultHelper.Get_ReturnJoin_Alias_DefaultValue(member) : GetAttributeValue(attribute.Alias, mappedClass));
            // Attribute: <property>
            writer.WriteAttributeString("property", attribute.Property==null ? DefaultHelper.Get_ReturnJoin_Property_DefaultValue(member) : GetAttributeValue(attribute.Property, mappedClass));
            // Attribute: <lock-mode>
            if(attribute.LockMode != LockMode.Unspecified)
            writer.WriteAttributeString("lock-mode", GetXmlEnumValue(typeof(LockMode), attribute.LockMode));

            WriteUserDefinedContent(writer, member, null, attribute);

            System.Collections.ArrayList memberAttribs = GetSortedAttributes(member);
            int attribPos; // Find the position of the ReturnJoinAttribute (its <sub-element>s must be after it)
            for(attribPos=0; attribPos<memberAttribs.Count; attribPos++)
                if( memberAttribs[attribPos] is ReturnJoinAttribute
                    && ((BaseAttribute)memberAttribs[attribPos]).Position == attribute.Position )
                    break; // found
            int i = attribPos + 1;

            // Element: <return-property>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ReturnPropertyAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ReturnJoinAttribute )
                        break; // Following attributes are for this ReturnJoin
                    if( memberAttrib is ReturnPropertyAttribute )
                        WriteReturnProperty(writer, member, memberAttrib as ReturnPropertyAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(ReturnPropertyAttribute), attribute);

            writer.WriteEndElement();
        }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:41,代码来源:HbmWriter.cs


示例6: WriteQueryParam

        /// <summary> Write a QueryParam XML Element from attributes in a member. </summary>
        public virtual void WriteQueryParam(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, QueryParamAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "query-param" );
            // Attribute: <name>
            writer.WriteAttributeString("name", attribute.Name==null ? DefaultHelper.Get_QueryParam_Name_DefaultValue(member) : GetAttributeValue(attribute.Name, mappedClass));
            // Attribute: <type>
            writer.WriteAttributeString("type", attribute.Type==null ? DefaultHelper.Get_QueryParam_Type_DefaultValue(member) : GetAttributeValue(attribute.Type, mappedClass));

            WriteUserDefinedContent(writer, member, null, attribute);

            writer.WriteEndElement();
        }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:13,代码来源:HbmWriter.cs


示例7: WriteProperties

        /// <summary> Write a Properties XML Element from attributes in a member. </summary>
        public virtual void WriteProperties(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, PropertiesAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "properties" );
            // Attribute: <name>
            writer.WriteAttributeString("name", attribute.Name==null ? DefaultHelper.Get_Properties_Name_DefaultValue(member) : GetAttributeValue(attribute.Name, mappedClass));
            // Attribute: <unique>
            if( attribute.UniqueSpecified )
            writer.WriteAttributeString("unique", attribute.Unique ? "true" : "false");
            // Attribute: <insert>
            if( attribute.InsertSpecified )
            writer.WriteAttributeString("insert", attribute.Insert ? "true" : "false");
            // Attribute: <update>
            if( attribute.UpdateSpecified )
            writer.WriteAttributeString("update", attribute.Update ? "true" : "false");
            // Attribute: <optimistic-lock>
            if( attribute.OptimisticLockSpecified )
            writer.WriteAttributeString("optimistic-lock", attribute.OptimisticLock ? "true" : "false");
            // Attribute: <node>
            if(attribute.Node != null)
            writer.WriteAttributeString("node", GetAttributeValue(attribute.Node, mappedClass));

            WriteUserDefinedContent(writer, member, null, attribute);

            System.Collections.ArrayList memberAttribs = GetSortedAttributes(member);
            int attribPos; // Find the position of the PropertiesAttribute (its <sub-element>s must be after it)
            for(attribPos=0; attribPos<memberAttribs.Count; attribPos++)
                if( memberAttribs[attribPos] is PropertiesAttribute
                    && ((BaseAttribute)memberAttribs[attribPos]).Position == attribute.Position )
                    break; // found
            int i = attribPos + 1;

            // Element: <property>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(PropertyAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is PropertiesAttribute )
                        break; // Following attributes are for this Properties
                    if( memberAttrib is PropertyAttribute )
                        WriteProperty(writer, member, memberAttrib as PropertyAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(PropertyAttribute), attribute);
            // Element: <many-to-one>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ManyToOneAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is PropertiesAttribute )
                        break; // Following attributes are for this Properties
                    if( memberAttrib is ManyToOneAttribute )
                        WriteManyToOne(writer, member, memberAttrib as ManyToOneAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(ManyToOneAttribute), attribute);
            // Element: <component>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ComponentAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
            }
            WriteUserDefinedContent(writer, member, typeof(ComponentAttribute), attribute);
            // Element: <dynamic-component>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(DynamicComponentAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is DynamicComponentAttribute )
                        WriteDynamicComponent(writer, member, memberAttrib as DynamicComponentAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(DynamicComponentAttribute), attribute);

            writer.WriteEndElement();
        }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:90,代码来源:HbmWriter.cs


示例8: WriteParam

        /// <summary> Write a Param XML Element from attributes in a member. </summary>
        public virtual void WriteParam(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, ParamAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "param" );
            // Attribute: <name>
            writer.WriteAttributeString("name", attribute.Name==null ? DefaultHelper.Get_Param_Name_DefaultValue(member) : GetAttributeValue(attribute.Name, mappedClass));

            WriteUserDefinedContent(writer, member, null, attribute);

            // Write the content of this element (mixed="true")
            writer.WriteString(attribute.Content);

            writer.WriteEndElement();
        }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:14,代码来源:HbmWriter.cs


示例9: WriteManyToAny

        /// <summary> Write a ManyToAny XML Element from attributes in a member. </summary>
        public virtual void WriteManyToAny(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, ManyToAnyAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "many-to-any" );
            // Attribute: <column>
            if(attribute.Column != null)
            writer.WriteAttributeString("column", GetAttributeValue(attribute.Column, mappedClass));
            // Attribute: <id-type>
            writer.WriteAttributeString("id-type", attribute.IdType==null ? DefaultHelper.Get_ManyToAny_IdType_DefaultValue(member) : GetAttributeValue(attribute.IdType, mappedClass));
            // Attribute: <meta-type>
            if(attribute.MetaType != null)
            writer.WriteAttributeString("meta-type", GetAttributeValue(attribute.MetaType, mappedClass));

            WriteUserDefinedContent(writer, member, null, attribute);

            System.Collections.ArrayList memberAttribs = GetSortedAttributes(member);
            int attribPos; // Find the position of the ManyToAnyAttribute (its <sub-element>s must be after it)
            for(attribPos=0; attribPos<memberAttribs.Count; attribPos++)
                if( memberAttribs[attribPos] is ManyToAnyAttribute
                    && ((BaseAttribute)memberAttribs[attribPos]).Position == attribute.Position )
                    break; // found
            int i = attribPos + 1;

            // Element: <meta-value>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(MetaValueAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ManyToAnyAttribute )
                        break; // Following attributes are for this ManyToAny
                    if( memberAttrib is MetaValueAttribute )
                        WriteMetaValue(writer, member, memberAttrib as MetaValueAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(MetaValueAttribute), attribute);
            // Element: <column>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ColumnAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ManyToAnyAttribute )
                        break; // Following attributes are for this ManyToAny
                    if( memberAttrib is ColumnAttribute )
                        WriteColumn(writer, member, memberAttrib as ColumnAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(ColumnAttribute), attribute);

            writer.WriteEndElement();
        }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:58,代码来源:HbmWriter.cs


示例10: WriteLoader

        /// <summary> Write a Loader XML Element from attributes in a member. </summary>
        public virtual void WriteLoader(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, LoaderAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "loader" );
            // Attribute: <query-ref>
            writer.WriteAttributeString("query-ref", attribute.QueryRef==null ? DefaultHelper.Get_Loader_QueryRef_DefaultValue(member) : GetAttributeValue(attribute.QueryRef, mappedClass));

            WriteUserDefinedContent(writer, member, null, attribute);

            writer.WriteEndElement();
        }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:11,代码来源:HbmWriter.cs


示例11: WriteListIndex

        /// <summary> Write a ListIndex XML Element from attributes in a member. </summary>
        public virtual void WriteListIndex(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, ListIndexAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "list-index" );
            // Attribute: <column>
            if(attribute.Column != null)
            writer.WriteAttributeString("column", GetAttributeValue(attribute.Column, mappedClass));
            // Attribute: <base>
            if(attribute.Base != -1)
            writer.WriteAttributeString("base", attribute.Base.ToString());

            WriteUserDefinedContent(writer, member, null, attribute);

            System.Collections.ArrayList memberAttribs = GetSortedAttributes(member);
            int attribPos; // Find the position of the ListIndexAttribute (its <sub-element>s must be after it)
            for(attribPos=0; attribPos<memberAttribs.Count; attribPos++)
                if( memberAttribs[attribPos] is ListIndexAttribute
                    && ((BaseAttribute)memberAttribs[attribPos]).Position == attribute.Position )
                    break; // found
            int i = attribPos + 1;

            // Element: <column>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ColumnAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is ListIndexAttribute )
                        break; // Following attributes are for this ListIndex
                    if( memberAttrib is ColumnAttribute )
                        WriteColumn(writer, member, memberAttrib as ColumnAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(ColumnAttribute), attribute);

            writer.WriteEndElement();
        }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:40,代码来源:HbmWriter.cs


示例12: WriteKeyManyToOne

        /// <summary> Write a KeyManyToOne XML Element from attributes in a member. </summary>
        public virtual void WriteKeyManyToOne(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, KeyManyToOneAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "key-many-to-one" );
            // Attribute: <name>
            writer.WriteAttributeString("name", attribute.Name==null ? DefaultHelper.Get_KeyManyToOne_Name_DefaultValue(member) : GetAttributeValue(attribute.Name, mappedClass));
            // Attribute: <access>
            if(attribute.Access != null)
            writer.WriteAttributeString("access", GetAttributeValue(attribute.Access, mappedClass));
            // Attribute: <class>
            if(attribute.Class != null)
            writer.WriteAttributeString("class", GetAttributeValue(attribute.Class, mappedClass));
            // Attribute: <entity-name>
            if(attribute.EntityName != null)
            writer.WriteAttributeString("entity-name", GetAttributeValue(attribute.EntityName, mappedClass));
            // Attribute: <column>
            if(attribute.Column != null)
            writer.WriteAttributeString("column", GetAttributeValue(attribute.Column, mappedClass));
            // Attribute: <foreign-key>
            if(attribute.ForeignKey != null)
            writer.WriteAttributeString("foreign-key", GetAttributeValue(attribute.ForeignKey, mappedClass));
            // Attribute: <lazy>
            if(attribute.Lazy != RestrictedLaziness.Unspecified)
            writer.WriteAttributeString("lazy", GetXmlEnumValue(typeof(RestrictedLaziness), attribute.Lazy));
            // Attribute: <not-found>
            if(attribute.NotFound != NotFoundMode.Unspecified)
            writer.WriteAttributeString("not-found", GetXmlEnumValue(typeof(NotFoundMode), attribute.NotFound));

            WriteUserDefinedContent(writer, member, null, attribute);

            System.Collections.ArrayList memberAttribs = GetSortedAttributes(member);
            int attribPos; // Find the position of the KeyManyToOneAttribute (its <sub-element>s must be after it)
            for(attribPos=0; attribPos<memberAttribs.Count; attribPos++)
                if( memberAttribs[attribPos] is KeyManyToOneAttribute
                    && ((BaseAttribute)memberAttribs[attribPos]).Position == attribute.Position )
                    break; // found
            int i = attribPos + 1;

            // Element: <meta>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(MetaAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is KeyManyToOneAttribute )
                        break; // Following attributes are for this KeyManyToOne
                    if( memberAttrib is MetaAttribute )
                        WriteMeta(writer, member, memberAttrib as MetaAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(MetaAttribute), attribute);
            // Element: <column>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ColumnAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is KeyManyToOneAttribute )
                        break; // Following attributes are for this KeyManyToOne
                    if( memberAttrib is ColumnAttribute )
                        WriteColumn(writer, member, memberAttrib as ColumnAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(ColumnAttribute), attribute);

            writer.WriteEndElement();
        }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:73,代码来源:HbmWriter.cs


示例13: WriteKey

        /// <summary> Write a Key XML Element from attributes in a member. </summary>
        public virtual void WriteKey(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, KeyAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "key" );
            // Attribute: <column>
            if(attribute.Column != null)
            writer.WriteAttributeString("column", GetAttributeValue(attribute.Column, mappedClass));
            // Attribute: <property-ref>
            if(attribute.PropertyRef != null)
            writer.WriteAttributeString("property-ref", GetAttributeValue(attribute.PropertyRef, mappedClass));
            // Attribute: <foreign-key>
            if(attribute.ForeignKey != null)
            writer.WriteAttributeString("foreign-key", GetAttributeValue(attribute.ForeignKey, mappedClass));
            // Attribute: <on-delete>
            if(attribute.OnDelete != OnDelete.Unspecified)
            writer.WriteAttributeString("on-delete", GetXmlEnumValue(typeof(OnDelete), attribute.OnDelete));
            // Attribute: <not-null>
            if( attribute.NotNullSpecified )
            writer.WriteAttributeString("not-null", attribute.NotNull ? "true" : "false");
            // Attribute: <update>
            if( attribute.UpdateSpecified )
            writer.WriteAttributeString("update", attribute.Update ? "true" : "false");
            // Attribute: <unique>
            if( attribute.UniqueSpecified )
            writer.WriteAttributeString("unique", attribute.Unique ? "true" : "false");

            WriteUserDefinedContent(writer, member, null, attribute);

            System.Collections.ArrayList memberAttribs = GetSortedAttributes(member);
            int attribPos; // Find the position of the KeyAttribute (its <sub-element>s must be after it)
            for(attribPos=0; attribPos<memberAttribs.Count; attribPos++)
                if( memberAttribs[attribPos] is KeyAttribute
                    && ((BaseAttribute)memberAttribs[attribPos]).Position == attribute.Position )
                    break; // found
            int i = attribPos + 1;

            // Element: <column>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ColumnAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is KeyAttribute )
                        break; // Following attributes are for this Key
                    if( memberAttrib is ColumnAttribute )
                        WriteColumn(writer, member, memberAttrib as ColumnAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(ColumnAttribute), attribute);

            writer.WriteEndElement();
        }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:55,代码来源:HbmWriter.cs


示例14: WriteJoin

        /// <summary> Write a Join XML Element from attributes in a member. </summary>
        public virtual void WriteJoin(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, JoinAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "join" );
            // Attribute: <table>
            writer.WriteAttributeString("table", attribute.Table==null ? DefaultHelper.Get_Join_Table_DefaultValue(member) : GetAttributeValue(attribute.Table, mappedClass));
            // Attribute: <schema>
            if(attribute.Schema != null)
            writer.WriteAttributeString("schema", GetAttributeValue(attribute.Schema, mappedClass));
            // Attribute: <catalog>
            if(attribute.Catalog != null)
            writer.WriteAttributeString("catalog", GetAttributeValue(attribute.Catalog, mappedClass));
            // Attribute: <subselect>
            if(attribute.Subselect != null)
            writer.WriteAttributeString("subselect", GetAttributeValue(attribute.Subselect, mappedClass));
            // Attribute: <fetch>
            if(attribute.Fetch != JoinFetch.Unspecified)
            writer.WriteAttributeString("fetch", GetXmlEnumValue(typeof(JoinFetch), attribute.Fetch));
            // Attribute: <inverse>
            if( attribute.InverseSpecified )
            writer.WriteAttributeString("inverse", attribute.Inverse ? "true" : "false");
            // Attribute: <optional>
            if( attribute.OptionalSpecified )
            writer.WriteAttributeString("optional", attribute.Optional ? "true" : "false");

            WriteUserDefinedContent(writer, member, null, attribute);

            System.Collections.ArrayList memberAttribs = GetSortedAttributes(member);
            int attribPos; // Find the position of the JoinAttribute (its <sub-element>s must be after it)
            for(attribPos=0; attribPos<memberAttribs.Count; attribPos++)
                if( memberAttribs[attribPos] is JoinAttribute
                    && ((BaseAttribute)memberAttribs[attribPos]).Position == attribute.Position )
                    break; // found
            int i = attribPos + 1;

            // Element: <subselect>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(SubselectAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is JoinAttribute )
                        break; // Following attributes are for this Join
                    if( memberAttrib is SubselectAttribute )
                        WriteSubselect(writer, member, memberAttrib as SubselectAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(SubselectAttribute), attribute);
            // Element: <comment>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(CommentAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is JoinAttribute )
                        break; // Following attributes are for this Join
                    if( memberAttrib is CommentAttribute )
                        WriteComment(writer, member, memberAttrib as CommentAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(CommentAttribute), attribute);
            // Element: <key>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(KeyAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is JoinAttribute )
                        break; // Following attributes are for this Join
                    if( memberAttrib is KeyAttribute )
                        WriteKey(writer, member, memberAttrib as KeyAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(KeyAttribute), attribute);
            // Element: <property>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(PropertyAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is JoinAttribute )
                        break; // Following attributes are for this Join
                    if( memberAttrib is PropertyAttribute )
                        WriteProperty(writer, member, memberAttrib as PropertyAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(PropertyAttribute), attribute);
            // Element: <many-to-one>
//.........这里部分代码省略.........
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:101,代码来源:HbmWriter.cs


示例15: WriteId

        /// <summary> Write a Id XML Element from attributes in a member. </summary>
        public virtual void WriteId(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, IdAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "id" );
            // Attribute: <name>
            if(attribute.Name != null)
            writer.WriteAttributeString("name", GetAttributeValue(attribute.Name, mappedClass));
            // Attribute: <node>
            if(attribute.Node != null)
            writer.WriteAttributeString("node", GetAttributeValue(attribute.Node, mappedClass));
            // Attribute: <access>
            if(attribute.Access != null)
            writer.WriteAttributeString("access", GetAttributeValue(attribute.Access, mappedClass));
            // Attribute: <column>
            if(attribute.Column != null)
            writer.WriteAttributeString("column", GetAttributeValue(attribute.Column, mappedClass));
            // Attribute: <type>
            if(attribute.Type != null)
            writer.WriteAttributeString("type", GetAttributeValue(attribute.Type, mappedClass));
            // Attribute: <length>
            if(attribute.Length != -1)
            writer.WriteAttributeString("length", attribute.Length.ToString());
            // Attribute: <unsaved-value>
            if(attribute.UnsavedValue != null)
            writer.WriteAttributeString("unsaved-value", GetAttributeValue(attribute.UnsavedValue, mappedClass));

            WriteUserDefinedContent(writer, member, null, attribute);

            System.Collections.ArrayList memberAttribs = GetSortedAttributes(member);
            int attribPos; // Find the position of the IdAttribute (its <sub-element>s must be after it)
            for(attribPos=0; attribPos<memberAttribs.Count; attribPos++)
                if( memberAttribs[attribPos] is IdAttribute
                    && ((BaseAttribute)memberAttribs[attribPos]).Position == attribute.Position )
                    break; // found
            int i = attribPos + 1;

            // Element: <meta>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(MetaAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is IdAttribute )
                        break; // Following attributes are for this Id
                    if( memberAttrib is MetaAttribute )
                        WriteMeta(writer, member, memberAttrib as MetaAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(MetaAttribute), attribute);
            // Element: <column>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, attribute, typeof(ColumnAttribute)) )
                    break; // next attributes are 'elements' of the same level OR for 'sub-elements'
                else
                {
                    if( memberAttrib is IdAttribute )
                        break; // Following attributes are for this Id
                    if( memberAttrib is ColumnAttribute )
                        WriteColumn(writer, member, memberAttrib as ColumnAttribute, attribute, mappedClass);
                }
            }
            WriteUserDefinedContent(writer, member, typeof(ColumnAttribute), attribute);
            // Element: <type>
            for(; i<memberAttribs.Count; i++)
            {
                BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute;
                if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType())
                    || IsNextElement(memberAttrib, att 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# BaseCell类代码示例发布时间:2022-05-24
下一篇:
C# Base64FormattingOptions类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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