c# - Creating a set from Table Valued Function in Entity Framework -


i have database big tables(some of them may have more 1,000,000 records) , every user of database should see of data, have multiple tvf(table valued function) user id , select records of table visible user(this operation require multiple select statements , think calling tvf far better implementing in code). in first release of program clients, had class multiple properties of type iqueryable implemented using linqtosql , worked great. have client want use assembly write wcf data service, have write class derived dbcontext(using ef) can used in specified service. problem is:

  • dbcontext automatically expose dbset properties defined in it, every user minimum level of access can see entire data of table(of course client app restrict data, client can access data directly , import data excel or access using odata)

  • i have multiple public properties of type iqueryable not appeared in list of data exposed wcf data service.

in order solve problem, think complete solution able call tvf table , create set it. don't know how this?!

note change database require logging, have stored procedures changes, require read access wcf data service , don't want default sets contain records of tables published in service

i think can functionality want using customized data service provider define shape of wcf service. can pretty complicated, since have bunch of iqueryables, you'll able use reflection provider, docs say:

the reflection provider exposes data in classes return types implement iqueryable interface. wcf data services uses reflection infer data model these classes , can translate address-based queries against resources language integrated query (linq)-based queries against exposed iqueryable types.

that documentation links "how to" using reflection provider. create pseudo-context class iqueryable properties, add few attributes data objects, , point dataservice @ pseudo-context type. (if you're using database/model-first ef, you'll need create partials of entities in order add attributes, or update t4 templates.)


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -