Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating a set from Table Valued Function in Entity Framework
    primarykey
    data
    text
    <p>I have a database with very big tables(some of them may have more than 1,000,000 records) and every user of this database should see some of this data, so we have multiple TVF(Table valued function) that get a user ID and select those records of the table that is visible to that user(this operation require multiple <code>SELECT</code> statements and I think calling TVF is far better than implementing it in the code). In first release of the program to my clients, I had a class with multiple properties of type <code>IQueryable</code> that implemented using LinqToSql and it worked great. Now I have a client that want to use my assembly to write a WCF data service, so I have to write a class derived from <code>DbContext</code>(using EF) that can be used in specified service. My problem is:</p> <ul> <li><p><code>DbContext</code> automatically expose all <code>DbSet</code> properties that defined in it, so every user with minimum level of access can see entire data of the table(of course client app will restrict data, but client can access data directly and even import those data to an Excel or Access using OData)</p></li> <li><p>I have multiple public properties of type <code>IQueryable</code> but they will not appeared in the list of data that exposed by WCF data service.</p></li> </ul> <p>In order to solve this problem, I think the most complete solution is to be able to call TVF as a table and create a set from it. But I don't know how to do this?!</p> <p><strong>Note</strong> Any change to the database require some logging, so I have stored procedures to do those changes, so I only require read only access to my WCF data service and I don't want default sets that contain all records of the tables published in the service</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload