If you using the generator in VS (ie, drap drop the data table and diagram and keys are all set in db), then the thing you are asking could be already there automatically e. G from Person in Context. Persons where Person.Name == "PETER PAN" select Person.User.Role.
RoleName Exact name need to refer to the code generator, but this is the idea. Linq to entities will help to map foreign keys and those for you Edit Actually I haven't tried using include. But according to msdn:include method the include should show the object hierarchy to work.
So, for your query to work, try: from c in db.Persons. Include("aspnet_Users"). Include("aspnet_Roles") where c.
Aspnet_Users. Aspnet_Roles. RoleName == "Role" select c And moreover, will you consider start from roles?
From r in db. Aspnet_Roles where r. RoleName == "ROLE" select r.
Aspnet_Users.Persons.
If you using the generator in VS (ie, drap drop the data table and diagram and keys are all set in db), then the thing you are asking could be already there automatically. E.g. From Person in Context.
Persons where Person. Name == "PETER PAN" select Person.User.Role. RoleName; Exact name need to refer to the code generator, but this is the idea.
Linq to entities will help to map foreign keys and those for you. Edit Actually I haven't tried using include. But according to msdn:include method, the include should show the object hierarchy to work.So, for your query to work, try: from c in db.Persons.
Include("aspnet_Users"). Include("aspnet_Roles") where c. Aspnet_Users.
Aspnet_Roles. RoleName == "Role" select c And moreover, will you consider start from roles? From r in db.
Aspnet_Roles where r. RoleName == "ROLE" select r. Aspnet_Users.Persons.
What I was orginally looking for was all users in a particular role not the role for each person. The problem with doing that was that aspnet_Users. Aspnet_Roles.
RoleName was not available for some reason... – user125140 Jul 24 '09 at 4:14 You mean mapping all users that belongs to a particular group, right? Could you post more here to see why it's not working? – xandy Jul 24 '09 at 8:29 return (from c in db.Persons.
Include("aspnet_Users") where c. Aspnet_Users. Aspnet_Roles.
RoleName == "Role" select c); is what I was querying with, RoleName however doesn't seem to exist... ("Role" is just a placeholder, I use an actual role when querying) – user125140 Jul 24 '09 at 8:40 Check the edited answer. – xandy Jul 24 '09 at 9:04 I thought about starting from roles and figured that would work, but I wanted to return a person. I though the syntax for include was to space the related tables using a dot syntax but will try with multiple include methods.
– user125140 Jul 24 '09 at 9:15.
(from you in db. Aspnet_Users. Include("Person") from c in db.
Aspnet_Roles where c. RoleName == "role" select u. Persons); Worked it out thanks for trying though.
It still feels a little unnatural to write something like that after writing sql for so long... – user125140 Jul 25 '09 at 0:25 1 return (from you in db. Persons from c in db. Aspnet_Roles where c.
RoleName == "" select u); even better version – user125140 Jul 25 '09 at 0:30 I've using Linq 2 Sql for some time and to me it is quite natural (except that when you need to think about performance). The only major different is that try not to think in sql's way when using Linq, and your question is quite unusual and I am sure in Linq 2 Sql I never encounter such situation (and I even never used Include before) – xandy Jul 25 '09 at 0:32.
This is the class of expressiveness and abstraction level that ADO.NET, and in particular LINQ and the Entity Framework working together, brings to application development. The rest of this paper describes in detail the various elements that work together in order to make the sample above work. Every business application has, explicitly or implicitly, a conceptual data model that describes the various elements of the problem domain, as well as each element's structure, the relationships between each element, their constraints, and so on.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.