当前位置: 首页>>代码示例>>C#>>正文


C# ITable.GetColumn方法代码示例

本文整理汇总了C#中ITable.GetColumn方法的典型用法代码示例。如果您正苦于以下问题:C# ITable.GetColumn方法的具体用法?C# ITable.GetColumn怎么用?C# ITable.GetColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITable的用法示例。


在下文中一共展示了ITable.GetColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessComponent

        private void ProcessComponent(component hComponent, Entity newEntity, ITable mappedTable, Dictionary<Class, ComponentSpecification> specifications, string hmNamespace, ParseResults parseResults)
        {
            if ([email protected] == null)
            {
                log.ErrorFormat("Could not load component named {0} on class {1} because it does not have a class attribute.", hComponent.name, newEntity.Name);
                return;
            }

            var possibleClasses = GetPossibleClasses([email protected], hmNamespace, mappedTable.Schema, parseResults);

            if (possibleClasses.Count == 0)
            {
                log.ErrorFormat("Could not load component named {0} on class {1} because we could not find the class named {2}.", hComponent.name, newEntity.Name, [email protected]);
                return;
            }
            ComponentSpecification spec = null;

            foreach (var possibleClass in possibleClasses)
            {
                spec = specifications.GetValueOrDefault(possibleClass);

                if (spec != null)
                    break;
            }

            bool createProperties = false;

            if (spec == null)
            {
                // Create a new spec from these.
                spec = new ComponentSpecificationImpl(GetShortClassName([email protected]));
                newEntity.EntitySet.AddComponentSpecification(spec);
                createProperties = true;
            }
            Component component = spec.CreateImplementedComponentFor(newEntity, hComponent.name);
            newEntity.Key.Component = component;

            var mapping = new ComponentMappingImpl();

            foreach (var prop in hComponent.Properties())
            {
                if (createProperties)
                {
                    ComponentProperty idProperty = new ComponentPropertyImpl(prop.name);
                    idProperty.Type = prop.type1;
                    idProperty.ValidationOptions.MaximumLength = prop.length.As<int>();
                    SetPropertyInfoFromParsedCode(possibleClasses, idProperty);

                    spec.AddProperty(idProperty);
                }

                var compProperty = component.GetProperty(prop.name);
                var column = mappedTable.GetColumn(prop.column.UnBackTick());
                if (column == null)
                {
                    // Create the column
                    column = entityProcessor.CreateColumn(compProperty.RepresentedProperty);
                    mapping.FromTable.AddColumn(column);
                }

                mapping.AddPropertyAndColumn(compProperty, column);
            }
            newEntity.EntitySet.MappingSet.AddMapping(mapping);
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:64,代码来源:EntityLoader.cs

示例2: ProcessComponentKey

        private bool ProcessComponentKey(compositeid hCompId, Entity newEntity, ITable mappedTable, Dictionary<Class, ComponentSpecification> specifications, string hmNamespace, ParseResults parseResults)
        {
            var possibleClasses = GetPossibleClasses([email protected], hmNamespace, mappedTable.Schema, parseResults);

            if (possibleClasses.Count == 0) return false;

            ComponentSpecification spec = null;

            foreach (var possibleClass in possibleClasses)
            {
                spec = specifications.GetValueOrDefault(possibleClass);

                if (spec != null)
                    break;
            }
            bool createProperties = false;

            if (spec == null)
            {
                // Create a new spec from these.
                spec = new ComponentSpecificationImpl(GetShortClassName([email protected]));
                newEntity.EntitySet.AddComponentSpecification(spec);
                createProperties = true;
            }

            Component component = spec.CreateImplementedComponentFor(newEntity, hCompId.name);
            newEntity.Key.Component = component;

            var mapping = new ComponentMappingImpl();

            foreach (var prop in hCompId.KeyProperties())
            {
                if (createProperties)
                {

                    ComponentProperty idProperty = new ComponentPropertyImpl(prop.name);
                    idProperty.Type = prop.type1;
                    idProperty.ValidationOptions.MaximumLength = prop.length.As<int>();
                    SetPropertyInfoFromParsedCode(possibleClasses, idProperty);

                    spec.AddProperty(idProperty);
                }

                var compProperty = component.GetProperty(prop.name);
                var column = mappedTable.GetColumn(prop.column1.UnBackTick());
                if (column == null)
                {
                    // Create the column
                    column = entityProcessor.CreateColumn(compProperty.RepresentedProperty);
                    mapping.FromTable.AddColumn(column);
                }

                mapping.AddPropertyAndColumn(compProperty, column);
            }
            newEntity.EntitySet.MappingSet.AddMapping(mapping);

            return true;
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:58,代码来源:EntityLoader.cs


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