Doesn anyone know how to check if Table Exist in Database or not
I am using Umbraco 8.18.12 and trying to get some data from table but in case table is not there in DB getting error
using (var scope = serviceProvider.CreateScope(autoComplete: true))
{
var sql = scope.SqlContext.Sql().Select("*").Where<Item>(x => x.id == itemId);
var record = scope.Database.SingleOrDefault<Item>(sql);
if (record != null)
{
test = true;
}
}
Doesn anyone know how I can check if table exist here ?
Doesn anyone know how to check if Table Exist in Database or not
I am using Umbraco 8.18.12 and trying to get some data from table but in case table is not there in DB getting error
Doesn anyone know how I can check if table exist here ?
Pretty sure there's no such function available in EF but you've got the following options:
and the following will be SQL Server specific
If you go for option 2 or 3 you may want to wrap those up in an extension method/helper.
Thanks Adam will try these solutions.
is working on a reply...