WPF data binding using ADO.NET Entity Framework 4 -


Good morning all,

I am ADO.NET EF4 (and probably ORM in general) and I I was hoping someone could help fill the gap in my knowledge.

In my example I have a generalized database with two tables: User & amp; Company

User // UserId (PK), Company ID (FK), Firstname, Lastname

Company // CompanyId (PK), company name

I have created an entity data model in my application to match these tables.

I now need to display a list of users with their company name in the list of controls. I realize that I can display a list of users :

  DatabaseEntities db = new DatabaseEntities (); Listbox1.ItemSource = db.Users; The problem here is obviously that it will display CompanyId as a protest against the company name.  

My question is; What is the best way to get company name? Can I create an archived procedure to return a different record set? Create a new organization with the fields I need?

I can think of many ways, but I'm not sure which is the best practice.

Any help is appreciated!

Understand this, I did not know that you can specify binding like this:

  & lt; Text block grid Column = "3" padding = "10,20,0,0" text = "{binding company.company name}" />  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -