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


C# Entity.ToString方法代码示例

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


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

示例1: AddLocatioNode

        protected TreeNode AddLocatioNode(Entity.InternalLocation loc)
        {
            TreeNode node = new TreeNode(loc.ToString());
            node.Tag = loc;
            node.ImageIndex = 11;
            EntityRootNode.Nodes.Add(node);

            return node;
        }
开发者ID:JeffM2501,项目名称:StarshipSimEngine,代码行数:9,代码来源:MainForm.Sidebar.cs

示例2: EntityNotAvailableException

 public EntityNotAvailableException(Entity entity)
     : base(string.Format(MathNet.Symbolics.Properties.Resources.ex_NotAvailable_Entity, (entity == null ? "N/A" : entity.ToString())))
 {
     this.entity = entity;
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:5,代码来源:EntityNotAvailableException.cs

示例3: GetEntitiesEnumerator

        public override IEnumerable<Entity> GetEntitiesEnumerator(OnContinueExceptionCallback exceptionNotifier, DataLoaderParams Params)
        {
            int count = 0;
            string initialTimePrefix = GetSecondsFrom2000Prefix();
            var properties = _params.PropertyToTypeMap.GetProperties().ToDictionary(c => c.Key.ToLower(), c => c.Value);
            string[] headers = _csvReader.GetFieldHeaders();
            bool isInlineKmlSnippetProvided = false;
            #region RDF
            string entitySet = SchemaEntity["EntitySet"].ToString();

            // rdf get the columns namespaces
            List<TableColumnsMetadataEntity> columnMetadata = TableDataLoader.GetRdfMetadataColumnNamespace(entitySet);
            List<string> namespacesRdf = new List<string>();
            List<string> validNamespaces = new List<string>();

            string namespaceToAdd = string.Empty;
            if (columnMetadata != null)
            {
                foreach (TableColumnsMetadataEntity columnMeta in columnMetadata)
                {
                    if (!string.IsNullOrEmpty(columnMeta.columnnamespace))
                    {
                        namespaceToAdd = columnMeta.columnnamespace.Split('=')[0] + '=';

                        if (namespaceToAdd.Split('=')[0] != string.Empty)
                        {
                            if (!validNamespaces.Contains(namespaceToAdd))
                            {
                                namespacesRdf.Add(columnMeta.columnnamespace);
                                validNamespaces.Add(namespaceToAdd);
                            }
                        }
                    }
                }
            }
            #endregion

            while (_csvReader.ReadNextRecord())
            {
                var entity = new Entity();
                bool isExceptionOccured = false;

                #region RDF

                XNamespace rdfNamespace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";

                XElement rdfXml = new XElement(rdfNamespace + "RDF",
                new XAttribute(XNamespace.Xmlns + "rdf", rdfNamespace.ToString()));

                // add new namespaces to the rdf snippet if they exist
                if (namespacesRdf != null)
                {
                    foreach (string ns in namespacesRdf)
                    {
                        if (!string.IsNullOrEmpty(ns))
                        {
                            rdfXml.Add(new XAttribute(XNamespace.Xmlns + ns.ToString().Split('=')[0], ns.ToString().Split('=')[1]));
                        }
                    }
                }

                XElement rdfXmlDescriptionElement = new XElement(rdfNamespace + "Description");
                rdfXml.Add(rdfXmlDescriptionElement);
                #endregion

                try
                {
                    for (int i = 0; i < _csvReader.FieldCount; ++i)
                    {
                        if (_csvReader[i] == null)
                            continue;

                        if (_csvReader[i].GetType() == typeof(DBNull))
                            continue;

                        var header = headers[i];

                        if (!isInlineKmlSnippetProvided)
                            isInlineKmlSnippetProvided = header.Equals(DataLoaderConstants.PropNameKmlSnippet,
                                                                       StringComparison.InvariantCultureIgnoreCase);

                        try
                        {
                            if (!properties.ContainsKey(header.ToLower()))
                                throw new ApplicationException("The row data is mismached with column definitions in data file.");

                            var stringType = properties[header.ToLower()];
                            var stringValue = _csvReader[i];

                            if (string.IsNullOrEmpty(stringValue))
                                continue;

                            var v = GetPropertyValue(stringType, stringValue);
                            entity.AddProperty(header, v);

                            #region RDF

                            if (header == Params.ProcessorParams.PartitionKeyPropertyName)
                            {
                                rdfXmlDescriptionElement.Add(new XAttribute(rdfNamespace + "about", stringValue));
//.........这里部分代码省略.........
开发者ID:aytacozkan,项目名称:OGDI-DataLab,代码行数:101,代码来源:CsvEntityProducer.cs

示例4: GetRecords

        public PagedRecords GetRecords(
            Entity entity,
            IList<BaseFilter> filters = null,
            string searchQuery = null,
            string order = null,
            string orderDirection = null,
            bool determineDisplayValue = false,
            int? page = null,
            int? take = null)
        {
            var search = new EntitySearch
            {
                Query = searchQuery,
                Properties = entity.SearchProperties
            };
            order = order.IsNullOrEmpty() ? entity.Key.FirstOrDefault().ColumnName : order;
            orderDirection = orderDirection.IsNullOrEmpty() ?
                "ASC" :
                orderDirection.ToUpper();
            var orderBy = order + " " + orderDirection;
            var columns = string.Join(",",
                entity.Properties
                    .Where(x =>
                        !x.IsForeignKey ||
                        (!x.TypeInfo.IsCollection && x.IsForeignKey))
                    .Select(x => x.ColumnName)
                    .Distinct());
            List<object> args;
            var where = ConvertFiltersToSql(filters, search, out args);

            var table = new DynamicModel(
                Admin.ConnectionStringName,
                entity.TableName,
                entity.JoinedKey);

            if (page.HasValue && take.HasValue)
            {
                var result = table.Paged(
                    columns: columns,
                    where: where,
                    orderBy: orderBy,
                    currentPage: page.Value,
                    pageSize: take.Value,
                    args: args.ToArray());

                var data = new List<DataRow>();
                foreach (var item in result.Items)
                {
                    data.Add(new DataRow(item, entity));
                }

                return new PagedRecords
                {
                    TotalItems = result.TotalRecords,
                    TotalPages = result.TotalPages,
                    Records = data
                };
            }
            else
            {
                var result = table.All(
                    columns: columns,
                    where: where,
                    orderBy: orderBy,
                    args: args.ToArray());

                var data = result
                    .Select(item => new DataRow(item, entity))
                    .ToList();

                if (determineDisplayValue)
                {
                    foreach (var row in data)
                    {
                        row.DisplayName = entity.ToString(row);
                    }
                }

                return new PagedRecords
                {
                    Records = data
                };
            }
        }
开发者ID:Thecentury,项目名称:Ilaro.Admin,代码行数:84,代码来源:RecordsSource.cs

示例5: AddToQue

			public void AddToQue (Entity entity)
			{
				if (entity.ToString () != null) {
					if (!updateQueDictionary.ContainsKey (entity.ToString ())) {
						updateQueDictionary.Add (entity.ToString (), entity);
					}
				}
			}
开发者ID:DanishKizilbash,项目名称:Cosmos4X,代码行数:8,代码来源:Finder.cs

示例6: GetRecords

        public IList<DataRow> GetRecords(
            Entity entity,
            IList<IEntityFilter> filters = null,
            string searchQuery = null,
            string order = null,
            string orderDirection = null,
            bool determineDisplayValue = false)
        {
            var search = new EntitySearch
            {
                Query = searchQuery,
                Properties = entity.SearchProperties
            };
            order = order.IsNullOrEmpty() ? entity.Key.ColumnName : order;
            orderDirection = orderDirection.IsNullOrEmpty() ?
                "ASC" :
                orderDirection.ToUpper();
            var orderBy = order + " " + orderDirection;
            var columns = string.Join(",",
                entity.Properties
                    .Where(x =>
                        !x.IsForeignKey ||
                        (!x.TypeInfo.IsCollection && x.IsForeignKey))
                    .Select(x => x.ColumnName)
                    .Distinct());
            List<object> args;
            var where = ConvertFiltersToSql(filters, search, out args);

            var table = new DynamicModel(
                AdminInitialise.ConnectionStringName,
                entity.TableName,
                entity.Key.ColumnName);

            var result = table.All(
                columns: columns,
                where: where,
                orderBy: orderBy,
                args: args.ToArray());

            var data = result
                .Select(item => new DataRow(item, entity))
                .ToList();

            if (determineDisplayValue)
            {
                foreach (var row in data)
                {
                    row.DisplayName = entity.ToString(row);
                }
            }

            return data;
        }
开发者ID:Anupam-,项目名称:Ilaro.Admin,代码行数:53,代码来源:RecordsSource.cs

示例7: GetEntitiesEnumerator

        public override IEnumerable<Entity> GetEntitiesEnumerator(OnContinueExceptionCallback exceptionNotifier, DataLoaderParams Params)
        {
            int count = 0;
            string initialTimePrefix = GetSecondsFrom2000Prefix();

            do
            {
                bool isExceptionOccured = false;
                var entity = new Entity();

                try
                {
                    for (int i = 0; i < _dataReader.FieldCount; ++i)
                    {
                        entity.AddProperty(_dataReader.GetName(i), _dataReader[i]);
                    }

                    var placemark = _kml.Descendants().Where(e => e.Name.LocalName == DataLoaderConstants.ElemNamePlacemark).
                                                    Where(e => e.Element(e.Name.Namespace + _params.MatchElementName) != null).
                                                    Where(e => e.Element(e.Name.Namespace + _params.MatchElementName)
                                                        .Value.Contains(_dataReader[_params.MatchPropertyName].ToString()))
                                                        .FirstOrDefault();
                    if (placemark != null)
                    {
                        placemark = new XElement(placemark);

                        foreach (string name in _params.KmlElementsToStrip)
                        {
                            if (string.IsNullOrEmpty(name)) continue;
                            placemark.Element(string.Concat(placemark.Name.Namespace, name)).Remove();
                        }

                        placemark.Element(placemark.Name.Namespace + DataLoaderConstants.ElemNameDescription).SetValue(entity.Id);

                        var p = placemark.ToString(SaveOptions.DisableFormatting)
                                                .Replace(DataLoaderConstants.NsKmlOld, DataLoaderConstants.NsKmlNew);

                        entity.AddProperty(DataLoaderConstants.PropNameKmlSnippet, p);
                    }
                    if (_sourceOrder)
                    {
                        entity.SetNumber(count, initialTimePrefix);
                    }
                }
                catch (Exception ex)
                {
                    exceptionNotifier(new EntityProcessingException(entity.ToString(), ex));
                    isExceptionOccured = true;
                }

                if (!isExceptionOccured)
                {
                    yield return entity;
                    count++;
                }
            }
            while (_dataReader.Read());
        }
开发者ID:aytacozkan,项目名称:OGDI-DataLab,代码行数:58,代码来源:DbaseKmlEntityProducer.cs


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