本文整理汇总了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;
}
示例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;
}
示例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));
//.........这里部分代码省略.........
示例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
};
}
}
示例5: AddToQue
public void AddToQue (Entity entity)
{
if (entity.ToString () != null) {
if (!updateQueDictionary.ContainsKey (entity.ToString ())) {
updateQueDictionary.Add (entity.ToString (), entity);
}
}
}
示例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;
}
示例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());
}