I am using Entity Framework 4.0, C# 4.0, .Net 2010 and SQL Server 2008 R2. I have created the following view in my SQL Server database:
create view viewGetMember
as
select distinct
row_number() over (order by member.Membership_Number) ID,
email.Communication_Point_Id id1,
member.Membership_Number Number,
dvt.Default_Name ParticipationStatus,
person.Given_Name GivenName,
person.Last_Name LastName,
adrs.House_Number HouseNumber,
adrs.Street Street,
adrs.Post_Code PostCode,
email.Email_Address EmailAddress
from
Participation member
inner join
Party_Participation pp on member.Participation_Id = pp.Participation_Id
inner join
Party party on pp.Party_Id = party.Party_Id
inner join
Individual person on party.Party_Id = person.Party_Id
inner join
Domain_Value_t9n dvt on member.Participation_Status = dvt.Domain_Value_Id
inner join
Communication_Point cpadrs on party.Party_Id = cpadrs.Party_Id
inner join
Communication_Point cpemail on party.Party_Id = cpemail.Party_Id
inner join
[Address] adrs on cpadrs.Communication_Point_Id = adrs.Communication_Point_Id
inner join
Email email on cpemail.Communication_Point_Id = email.Communication_Point_Id
where
member.Membership_Number is not null
go
select * from viewGetMember
In want to add this view in entity framework. However it has contain no primary in it. Though following two fields can form a composite primary key (second and third columns).
- email.Communication_Point_Id id1
- member.Membership_Number Number
I don't know how to add them as part of Entity Framework. Even I have tried adding row_number()
(first column) as an additional column by thinking it will act as a kind of primary key but no use. Entity Framework designer is not adding this view in .edmx model file.
I have tried this by entirely removing the .edmx file and in new project only for Entity Framework but no luck. Could someone please provide me a solution to this problem.