本文整理汇总了C#中Entity.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.ToString方法的具体用法?C# Entity.ToString怎么用?C# Entity.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteSqlSync
public SqlPreCommand DeleteSqlSync(Entity ident, string comment = null)
{
var pre = OnPreDeleteSqlSync(ident);
var collections = (from tml in this.TablesMList()
select new SqlPreCommandSimple("DELETE {0} WHERE {1} = {2} --{3}"
.FormatWith(tml.Name, tml.BackReference.Name.SqlEscape(), ident.Id, comment ?? ident.ToString()))).Combine(Spacing.Simple);
var main = new SqlPreCommandSimple("DELETE {0} WHERE {1} = {2} --{3}"
.FormatWith(Name, this.PrimaryKey.Name.SqlEscape(), ident.Id, comment ?? ident.ToString()));
return SqlPreCommand.Combine(Spacing.Simple, pre, collections, main);
}
示例2: DeleteChanges
public string DeleteChanges(Entity entity, IDictionary<string, object> existingRecord)
{
var display = entity.ToString();
var joinedKeyValue = "#" + entity.JoinedKeyValue;
if (display != joinedKeyValue)
{
display += " ({0})".Fill(joinedKeyValue);
}
return "Deleted " + display;
}
示例3: CreateChanges
public string CreateChanges(Entity entity)
{
var display = entity.ToString();
var joinedKeyValue = "#" + entity.JoinedKeyValue;
if (display != joinedKeyValue)
{
display += " ({0})".Fill(joinedKeyValue);
}
return "Created " + display;
}
示例4: HandleReceiveEntity
private void HandleReceiveEntity(Entity ent)
{
if (ent is Response)
HandleResponse(ent as Response);
else if (ent is Request)
HandleRequest(ent as Request);
else if (ent is Notice)
HandleNotice(ent as Notice);
else
Console.WriteLine("TEBPProvicer received an invalid entity (ignored).");
if (ent.RequiresAnswer && !ent.Responded)
throw new NotSupportedException("The entity " + ent.ToString() + " has not been responded to.");
}
示例5: RunTest
static void RunTest(Store testlist, Entity test, bool shouldSucceed, int mode)
{
string inputpath = null, outputpath = null,
inputformat = null, outputformat = null,
inputbase = null, outputbase = null;
if (mode == 0) {
inputformat = "xml";
outputformat = "n3";
string uribase = "http://www.w3.org/2000/10/rdf-tests/rdfcore/";
Resource input = testlist.SelectObjects(test, "http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#inputDocument")[0];
inputbase = input.Uri;
inputpath = input.Uri.Substring(uribase.Length);
if (testlist.SelectObjects(test, "http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#outputDocument").Length > 0) {
Resource output = testlist.SelectObjects(test, "http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#outputDocument")[0];
outputpath = output.Uri.Substring(uribase.Length);
outputbase = output.Uri;
}
} else if (mode == 1) {
inputformat = "n3";
outputformat = "n3";
inputbase = "file:/home/syosi/cvs-trunk/WWW/2000/10/swap/test/n3parser.tests";
string uribase = "http://www.example.org/";
if (testlist.SelectObjects(test, "http://www.w3.org/2004/11/n3test#inputDocument").Length == 0) return;
Resource input = testlist.SelectObjects(test, "http://www.w3.org/2004/11/n3test#inputDocument")[0];
inputpath = input.Uri.Substring(uribase.Length);
if (testlist.SelectObjects(test, "http://www.w3.org/2004/11/n3test#outputDocument").Length > 0) {
Resource output = testlist.SelectObjects(test, "http://www.w3.org/2004/11/n3test#outputDocument")[0];
outputpath = output.Uri.Substring(uribase.Length);
}
}
string desc = test.ToString();
try {
desc += " " + ((Literal)testlist.SelectObjects(test, "http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#description")[0]).Value;
} catch (Exception e) {
}
try {
total++;
RdfReader reader = RdfReader.Create(inputformat, Path.Combine(basepath, inputpath));
reader.BaseUri = inputbase;
MemoryStore inputmodel = new MemoryStore(reader);
if (reader.Warnings.Count > 0) {
string warnings = String.Join("; ", (string[])((ArrayList)reader.Warnings).ToArray(typeof(string)));
throw new ParserException(warnings);
}
if (!shouldSucceed) {
Console.WriteLine(desc + ": Should Not Have Passed **\n");
badpass++;
return;
}
if (shouldSucceed && outputpath != null) {
RdfReader reader2 = RdfReader.Create(outputformat, Path.Combine(basepath, outputpath));
reader2.BaseUri = outputbase;
MemoryStore outputmodel = new MemoryStore(reader2);
CompareModels(inputmodel, outputmodel);
}
} catch (System.IO.FileNotFoundException ex) {
Console.WriteLine(inputpath + " Not Found");
error++;
} catch (System.IO.DirectoryNotFoundException ex) {
Console.WriteLine(inputpath + " Not Found");
error++;
} catch (ParserException ex) {
if (shouldSucceed) {
Console.WriteLine(desc + ": " + ex.Message + " **");
Console.WriteLine();
badfail++;
}
}
}
示例6: PrintEntity
/// <summary>
/// Prints the description for an individual entity on its own line.
/// </summary>
/// <param name="entity"></param>
private static void PrintEntity( Entity entity )
{
Console.Out.WriteLine( entity.GetID() + " - " + entity.ToString() + " [" + entity.m_Type.ToString() + "]" );
}
示例7: GetUniqueName
string GetUniqueName( Set<string> names, Entity entity )
{
string name = entity.Name;
if( string.IsNullOrEmpty( name ) )
name = entity.ToString();
string uniqueName;
for( int n = 1; ; n++ )
{
uniqueName = name;
if( n != 1 )
uniqueName += n.ToString();
if( !names.Contains( uniqueName ) )
break;
}
return uniqueName;
}