本文整理汇总了C#中Source.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Source.ToString方法的具体用法?C# Source.ToString怎么用?C# Source.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Source
的用法示例。
在下文中一共展示了Source.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TrackEvent
public static void TrackEvent(Source e, Action action, string label)
{
try
{
// Terminology borrowed from GA
// string javaScriptTrack = "_gaq.push(['_trackEvent', '" + e.ToString() + "', '" + action.ToString() + "', '" + label + "']);";
string javaScriptTrack = "trackEvent('" + e.ToString() + "','" + action.ToString() + "','" + label + "')";
object returnObject = HtmlPage.Window.Eval(javaScriptTrack);
}
catch { }
}
示例2: TestToString
public void TestToString()
{
//---------------Set up test pack-------------------
string sourceName = TestUtil.GetRandomString();
Source source = new Source(sourceName);
//---------------Execute Test ----------------------
string sourceToString = source.ToString();
//---------------Test Result -----------------------
StringAssert.AreEqualIgnoringCase(sourceName, sourceToString);
//---------------Tear Down -------------------------
}
示例3: CreateStream
public static Stream CreateStream(Source.SourceType type, Bloc onBloc, bool visible = true)
{
StreamInfo stream = streamInfoByType[type];
if(!stream)
{
Debug.LogError("Creating a stream of an unknown type. [" + type.ToString() + "]");
return null;
}
GameObject streamObj = CreateObjectFromStreamInfo(stream, visible);
streamObj.tag = "Stream";
streamObj.layer = LayerMask.NameToLayer("Streams");
streamObj.transform.parent = onBloc.gameObject.transform;
if(!streamObj)
{
Debug.LogError("Error creating the stream. [" + type.ToString() + "]");
return null;
}
return streamObj.GetComponent<Stream>();
}
示例4: CreateSource
// Commodity, to assemble all sources under an object's hierarchy node in the editor
public static Source CreateSource(Source.SourceType type)
{
SourceInfo source = sourceInfoByType[type];
if(!source)
{
Debug.LogError("Creating a source of an unknown type. [" + type.ToString() + "]");
return null;
}
GameObject sourceObj = CreateObjectFromSourceInfo(source);
sourceObj.tag = "Source";
sourceObj.layer = LayerMask.NameToLayer("Sources");
sourceObj.transform.parent = sourceNode.transform;
if(!sourceObj)
{
Debug.LogError("Error creating the source. [" + type.ToString() + "]");
return null;
}
return sourceObj.GetComponent<Source>();
}
示例5: TestToString_WithJoin
public void TestToString_WithJoin()
{
//---------------Set up test pack-------------------
string sourceName = TestUtil.GetRandomString();
Source source = new Source(sourceName);
string subSourceName = TestUtil.GetRandomString();
source.JoinToSource(new Source(subSourceName));
//---------------Execute Test ----------------------
string sourceToString = source.ToString();
//---------------Test Result -----------------------
string expectedSourceToString = string.Format("{0}.{1}", sourceName, subSourceName);
StringAssert.AreEqualIgnoringCase(expectedSourceToString, sourceToString);
//---------------Tear Down -------------------------
}
示例6: AddAliasForSource
private void AddAliasForSource(Source source)
{
if (source == null) return;
var sourceName = source.ToString();
if (this.Aliases.ContainsKey(sourceName)) return;
_aliasCount = _aliasCount + 1;
var sourceParts = sourceName.Split('.').ToList();
Queue<string> queue = new Queue<string>();
sourceParts.ForEach(queue.Enqueue);
string subSourceName = "";
while (queue.Count > 0)
{
if (!String.IsNullOrEmpty(subSourceName)) subSourceName += ".";
var singlePartOfSourceName = queue.Dequeue();
subSourceName += singlePartOfSourceName;
if (queue.Count > 0 && queue.Peek() == singlePartOfSourceName) continue;
if (!this.Aliases.ContainsKey(subSourceName))
this.Aliases.Add(subSourceName, "a" + _aliasCount);
}
if (source.ChildSource != null) AddAliasForSource(source.ChildSource);
if (source.ChildSourceLeaf != null) AddAliasForSource(source.ChildSourceLeaf);
foreach (var queryField in Fields)
{
AddAliasForSource(queryField.Value.Source);
}
source.InheritanceJoins.ForEach(@join =>
{
if (!this.Aliases.ContainsKey(@join.ToString())) AddAliasForSource(@join.FromSource);
if (!this.Aliases.ContainsKey(@join.ToSource.ToString())) AddAliasForSource(@join.ToSource);
});
source.Joins.ForEach(@join =>
{
if (!this.Aliases.ContainsKey(@join.FromSource.ToString())) AddAliasForSource(@join.FromSource);
if (!this.Aliases.ContainsKey(@join.ToSource.ToString())) AddAliasForSource(@join.ToSource);
});
}
示例7: RtpEL
public RtpEL(Source source)
:base(LOG_NAME, ".", source.ToString())
{ }
示例8: ArchiveServiceEventLog
public ArchiveServiceEventLog(Source source)
:base(LOG_NAME, ".", source.ToString())
{
//base.TickBetweenEachEntry = 1000 * Constants.TicksPerMs;
base.TickBetweenEachEntry = -1;
}
示例9: TestAddNewJoinTo_AlreadyJoined
public void TestAddNewJoinTo_AlreadyJoined()
{
//---------------Set up test pack-------------------
Source fromSource = new Source("FromSource", "FromSourceEntity");
Source.JoinList joinList = new Source.JoinList(fromSource);
Source toSource = new Source("ToSource", "ToSourceEntity");
Source toSource2 = new Source("ToSource", "ToSourceEntity");
joinList.AddNewJoinTo(toSource, Source.JoinType.InnerJoin);
//-------------Assert Preconditions -------------
Assert.AreEqual(1, joinList.Count);
//---------------Execute Test ----------------------
joinList.AddNewJoinTo(toSource2, Source.JoinType.InnerJoin);
//---------------Test Result -----------------------
Assert.AreEqual(1, joinList.Count);
Assert.AreEqual(fromSource.ToString(), joinList[0].FromSource.ToString());
Assert.AreEqual(toSource.ToString(), joinList[0].ToSource.ToString());
}
示例10: TestJoinToSource_AlreadyJoined
public void TestJoinToSource_AlreadyJoined()
{
//---------------Set up test pack-------------------
Source fromSource = new Source("FromSource", "FromSourceEntity");
Source toSource = new Source("ToSource", "ToSourceEntity");
Source toSource2 = new Source("ToSource", "ToSourceEntity");
fromSource.JoinToSource(toSource);
//---------------Execute Test ----------------------
fromSource.JoinToSource(toSource2);
//---------------Test Result -----------------------
Assert.AreEqual(1, fromSource.Joins.Count);
Assert.AreEqual(fromSource.ToString(), fromSource.Joins[0].FromSource.ToString());
Assert.AreEqual(toSource.ToString(), fromSource.Joins[0].ToSource.ToString());
}
示例11: TestJoinToSource
public void TestJoinToSource()
{
//---------------Set up test pack-------------------
var fromSource = new Source("FromSource", "FromSourceEntity");
var toSource = new Source("ToSource", "ToSourceEntity");
//---------------Execute Test ----------------------
fromSource.JoinToSource(toSource);
//---------------Test Result -----------------------
Assert.AreEqual(1, fromSource.Joins.Count);
Assert.AreEqual(fromSource.ToString(), fromSource.Joins[0].FromSource.ToString());
Assert.AreEqual(toSource.ToString(), fromSource.Joins[0].ToSource.ToString());
//---------------Tear Down -------------------------
}
示例12: ConferenceEventLog
public ConferenceEventLog(Source source)
: base(LOG_NAME, ".", source.ToString())
{
}
示例13: Test_CreateSQL_ShouldUseAliasesInJoins
public void Test_CreateSQL_ShouldUseAliasesInJoins()
{
//---------------Set up test pack-------------------
var mysource = new Source("mysource");
QueryField fieldOnMySource = new QueryField("testfield", "testfield", mysource);
Source joinedTableSource = new Source("myjoinedtosource");
QueryField fieldOnJoinedTableSource = new QueryField("testfield", "testfield", joinedTableSource);
mysource.Joins.Add(new Source.Join(mysource, joinedTableSource));
mysource.Joins[0].JoinFields.Add(new Source.Join.JoinField(fieldOnMySource, fieldOnJoinedTableSource));
SourceDB sourceDB = new SourceDB(mysource);
SqlFormatter sqlFormatter = new SqlFormatter("[", "]", "", "LIMIT");
IDictionary<string, string> aliases = new Dictionary<string, string>() { { mysource.ToString(), "a1" }, { joinedTableSource.ToString(), "a2"} };
//---------------Execute Test ----------------------
string sql = sourceDB.CreateSQL(sqlFormatter, aliases);
//---------------Test Result -----------------------
StringAssert.AreEqualIgnoringCase(
"([mysource] a1 JOIN [myjoinedtosource] a2 on a1.[testfield] = a2.[testfield])", sql);
}
示例14: Test_ToString_ShouldUseAliases
public void Test_ToString_ShouldUseAliases()
{
//---------------Set up test pack-------------------
const string sourceName = "mysource";
var source1 = new Source(sourceName);
Source field1Source = source1;
QueryField field1 = new QueryField("testfield", "testfield", field1Source);
Criteria criteria = new Criteria(field1, Criteria.ComparisonOp.Equals, "myvalue");
IDictionary<string, string> aliases = new Dictionary<string, string>() { { source1.ToString(), "a1" } };
CriteriaDB criteriaDb = new CriteriaDB(criteria);
SqlFormatter sqlFormatter = new SqlFormatter("[", "]", "", "LIMIT");
//---------------Execute Test ----------------------
string whereClause = criteriaDb.ToString(sqlFormatter, value => "Param", aliases);
//---------------Test Result -----------------------
StringAssert.AreEqualIgnoringCase("a1.[testfield] = Param", whereClause);
}
示例15: TestSetupAliases_SetsAliasOnSource
public void TestSetupAliases_SetsAliasOnSource()
{
//---------------Set up test pack-------------------
SelectQuery selectQuery = new SelectQuery();
const string sourceName = "mysource";
var source1 = new Source(sourceName);
selectQuery.Source = source1;
selectQuery.Criteria = null;
//---------------Execute Test ----------------------
SelectQueryDB selectQueryDb = new SelectQueryDB(selectQuery, DatabaseConnection.CurrentConnection);
//---------------Test Result -----------------------
Assert.AreEqual("a1", selectQueryDb.Aliases[source1.ToString()]);
}