score:8
a much better option would be to store the version differences as configuration. this could be stored in the database itself, a configuration file or even web.config.
otherwise you'll end up with messy code like:
int result = entity.executestorequery<int>(@"
if exists (select * from sys.tables where name = 'tablename')
select 1
else
select 0
").singleordefault();
score:2
the only possible ways are
- query table and get exception
- use native sql to query system views and look for that table - in efv4 you can execute query directly from
objectcontext
by callingexecutestorequery
.
your entity model will still have this table so in my opinion you should simply ship your db with that table and in application code handle if feature is allowed or not (table will not be used but will be in db).
if you want to make modular system then whole your feature (including application code) should not be present when client don't want to use it.
Source: stackoverflow.com
Related Query
- Check if a table exists within a database using LINQ
- Efficiently check if record exists in database using Entity framework LINQ
- Check if username already exists in database using linq
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- How to check whether a table exists within DataSet using multiple values at once?
- check if record exists in database using LINQ
- Linq - check if the any of the values present in an array exists in the database table
- How to Check if Data Exists in Table using LinQ to SQL
- Get X random elements from table in database using Linq or lambda in C#
- C# check an element exists while using LINQ to XML
- Retrieving Data from database within the last 7 days using linq
- Best way to check if value exists for a key in ILookup<string, string> using linq
- Check dates fall within range using Linq
- MVC Controller: Using LINQ to check for duplicate value already existing in table before Save?
- Check if a value from one array exists in another array using linq
- Export SQL Server Database Table to XML Using Linq
- Check if any XML nodes exists with Specific Attribute using LINQ C#
- Can't add a new record with an integer value into database by using linq from code C#
- Check a value from a second table within a LINQ Statement
- How to update a table in database using LINQ in F#?
- How do I select the top ten scores in a database table full of scores using linq in C#
- inserting multiple lines to a database table using LINQ query
- Linq - How to check if an object exists in database
- How to match exact Id within Comma seperated database column using LINQ and Lambda
- Using Linq to SQL to Check Table Privileges of Current User
- How to check if username is already exists in data table with LINQ TO SQL
- search database table record using two parameters in linq
- How to reinsert data from one table onto itself using LINQ in code migration?
- how to insert data in 1 table and update another table in a sql database using linq
- How to join one row to every row in source table using LINQ
More Query from same tag
- Entity Framework Core Select Property with multiple conditions
- Why doesn't Distinct (Linq) work in a List of int[]?
- How to handle linq statement returning exception when no file found
- LINQ Specified Cast is Not Valid with a ushort Table Column
- How to perform group by operation in dataTable using multiple columns in dynamically in c#?
- Non Overlappings datetimes in two lists
- Dynamic Linq Property Converting to Sql
- Entity Framkework 'like' statement query
- create a generic method that sorts List<T> collections
- Custom Sort Based On Referenced Records
- Unable to pass IEnumerable<string> as parameter in Expression.Call
- Running number of items in subgroups within ienumerable of items
- Is it possible to use Entity Framework without LINQ?
- How to define maxlength of @Html.DisplayFor in MVC?
- How to perform left outer join in Linq
- whole page refresh on map jquery
- c# decimal to hex & hex to decimal / hex to ascii in LINQ
- Comparing two lists using linq based on Value
- Hashset check count before enumerating using Linq
- Creating dynamic Linq query based on property values
- Is it possible to use LINQ to sum the value of multiple objects in a new object
- How to use contains in Azure table Linq query?
- Using Dynamic Linq To Filter A Collection
- Entity Framework query student grade for a specific subject
- converting SQL double in String
- Lambda expression for nested foreach
- How to select unique rows from left table while doing left join operation between two tables in Entity Framework
- VB.NET Group by two columns and write results to an array
- Linq Enity Framework, select from collection within IQueryable navigation property
- reorder csv by second column, case sensitive