Last post Sep 11, 2008 05:06 PM by sjnaughton
Sep 10, 2008 03:39 PM|codeblock|LINK
Hi all. I would like to ask you about a problem I've not found a solution using Dynamic Data.
In my solution I have some Vehicles, and each vehicle can be assigned to a Company. In my domain there are also many other classes and many of this are directly or indirectly correlated to the Company entity. So now I have to show only the Vehicles related
to a single Company (and not all the Vehicles from all the Companies) basing my choice on the Company related to the authenticated User. This is a common scenario in applications that host services for many different customers. All the entities of the domain
has an "ownership", directly (Vehicles of a Company) or indirectly through other entities (Devices mounted on Vehicles of a Company), and it is not possible to edit tables in a flat way.
I've not found a solution to this problem. The scaffolded entities (I'm using Entity Framework) always show all the records from its table and there is no way to achieve a different behavior.
Is that a scenario not supported or am I missing something?
Sep 10, 2008 05:43 PM|sjnaughton|LINK
Hi Andrea, have a look at this article on my blog here Part 4 -
Limit Tables shown on Default page and List, Edit & Details etc. where I was limiting row by the authenticated user.
Hope this helps [:D]
Sep 11, 2008 04:29 PM|codeblock|LINK
Your post is interesting but does not answer to my problem. I try to explain it again:
Think about having three entities, Company, Vehicle and Device. A Company has many Vehicles and a Vehicle has many Devices (but also Device has many Vehicles)
Then you think logging into the system with an User of the Company with ID == 11, I have to show only Vehicles related to this Company where Vehicle.Company.ID == 11. Also I have to show only Devices related to the same company where Device.Vehicles[n].Company.ID
The problems here are two:
One solution I'm trying is to expose an entity model based on views that adds to every entity the company ID. But this is a dirty solution because I've to change my entity model for a technical problem.
ASP.NET Dynamic Data
Ado.Net Entity Data Model
Sep 11, 2008 05:06 PM|sjnaughton|LINK
Realy sorry I meant to post this link DynamicData -
Limit Data Displayed By User [:$]
Hope this makes sense [:D]