本文整理汇总了C#中Where.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Where.ToString方法的具体用法?C# Where.ToString怎么用?C# Where.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Where
的用法示例。
在下文中一共展示了Where.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AreaBurst
/// <summary>
/// Close burst n (where N is a positive integer).
/// </summary>
/// <param name="powerName">
/// The <see cref="Power"/> this is for. This cannot be null or empty.
/// </param>
/// <param name="size">
/// The size of the burst in squares. This must be positive.
/// </param>
/// <param name="where">
/// Where the burst occurs. This cannot be null.
/// </param>
/// <returns></returns>
/// <exception cref="ArgumentNullException">
/// Neither <paramref name="powerName"/> nor <paramref name="where"/> can be null.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="size"/> must be positive.
/// </exception>
public static AttackTypeAndRange AreaBurst(string powerName, int size, Where where)
{
if (string.IsNullOrEmpty(powerName))
{
throw new ArgumentNullException("powerName");
}
if (where == null)
{
throw new ArgumentNullException("where");
}
if (size <= 0)
{
throw new ArgumentException("range must be positive", "size");
}
return new AttackTypeAndRange(powerName, AttackType.Area,
"burst " + size.ToString() + " " + where.ToString().ToLower());
}
示例2: Import
private void Import(Type typeMapping,
Action<ExecuteEventArgs> executing,
Action<ExecuteEventArgs> onStart,
Action<ExecuteEventArgs> onEnd,
string tag,
Where where,
IEnumerable<XElement> q)
{
#region init
Connection connection = null;
Unimake.ETL.Destination.ObjectDestination destination = null;
foreach(var el in q)
{
if(Ignore(el)) continue;
try
{
connection = DbContext.CreateConnection();
#region init
IParentModel model = null;
string TDestination = GetAttribute(el, "type");
#endregion
#region source
string query = el.Element("Query").Value.ToString();
//aqui iremos assumir que sempre terá o [[where]] se não tiver, sem problemas
string w = "";
string v = "";
if(where != null)
{
w = where.ToString();
//também temos o @value, que sempre será informado, logo, temos que substituir o @value, por algum valor.
//este vem informado no parameters do Where
if(where.Parameters.Contains("@value"))
v = Unimake.Convert.ToString(where.Parameters["@value"].Value);
}
query = query.Replace("[[where]]", w);
query = query.Replace("@value", v);
Source = new Unimake.ETL.Source.SqlSource(Connection);
((Unimake.ETL.Source.SqlSource)Source).FromQuery(query);
#endregion
#region destination
if(String.IsNullOrEmpty(TDestination))
throw new ArgumentNullException("type", "O atributo \"type\" é requerido para o tipo \"" + el.Name + "\" dentro do XML.");
destination = new Unimake.ETL.Destination.ObjectDestination();
destination.SetObjectResult(Activator.CreateInstance(Unimake.Convert.ToType(TDestination)));
#endregion
#region transform
Transform = new Unimake.ETL.Transform.Transform(Source, destination);
var mappings = el.Elements("MappingKey");
MappingKeys = (from x in mappings.Elements()
select ToMappingKey(x))
.ToList();
foreach(MappingKey item in MappingKeys)
{
Transform.Map(item.From, item.To, item.ToFunc());
}
#endregion
#region execute
destination.ProcessWithAction((s, r) =>
{
model = s as IParentModel;
//-------------------------------------------------------------------------
// Pesquisar e validar se existe
//-------------------------------------------------------------------------
string table = model.GetTableName();
string sql = String.Format("SELECT GUID FROM {0} WHERE EGUID = @p1", table);
IList<Parameter> parameters = new List<Parameter>();
parameters.Add(new Parameter
{
ParameterName = "@p1",
Value = model.EGUID
});
if(Settings.Tables[table].Fields.Contains("Excluido"))
{
sql += String.Format(" AND Excluido = @p2", table);
parameters.Add(new Parameter
{
ParameterName = "@p2",
Value = Excluido.Nao
});
}
//.........这里部分代码省略.........