Database Reference
In-Depth Information
context.WebProducts.Add(w1);
context.WebProducts.Add(w2);
context.WebProducts.Add(w3);
context.SaveChanges();
}
using (var context = new EFRecipesEntities())
{
Console.WriteLine("Query using eSQL...");
var esql = @"select value
EFRecipesModel.Store.ISNULL(p.Description,p.Name)
from EFRecipesEntities.WebProducts as p";
var objectContext = (context as IObjectContextAdapter).ObjectContext;
var prods = objectContext.CreateQuery<string>(esql);
foreach (var prod in prods)
{
Console.WriteLine("Product Description: {0}", prod);
}
}
using (var context = new EFRecipesEntities())
{
Console.WriteLine();
Console.WriteLine("Query using LINQ...");
var prods = from p in context.WebProducts
select BuiltinFunctions.ISNULL(p.Description, p.Name);
foreach (var prod in prods)
{
Console.WriteLine(prod);
}
}
}
}
public class BuiltinFunctions
{
[EdmFunction("EFRecipesModel.Store", "ISNULL")]
public static string ISNULL(string check_expression, string replacementvalue)
{
throw new NotSupportedException("Direct calls are not supported.");
}
}
 
Search WWH ::




Custom Search