How to create an editor to represent the database (with joins) in Windows Forms / WPF?

What would be the easiest way to create a quick editor for some data in a database in WPF / WinForms, where the data is represented by a view in a SQL Server database?

Let's say I have a table Person { id int, name nvarchar(max), GenderID int, CityID int} , where GenderID and CityID are a reference to the Gender and City tables. In the editor, Person will be displayed as a text box for the name, combobox for the floor (selection of gender names from the Gender table) and the same for the city column.

Is there something easy that I can do for some control / code to generate this? If I only want to select data, then WinForms DataGridView or WPF DataGrid can generate a column for each property and show a row for each object in the collection. -

Is there some kind of magical control that could do this to represent the database if the relationships are defined by a foreign key?

It seems to me that thousands of developers have faced such a problem - quickly create a graphical interface for editing database rows with relationships to other tables, so there should be some kind of generally accepted solution. Or does everyone do it in code? Or, if there is a tool for this in another language, not C #, not Windows Forms - like dBase.

+8
c # sql winforms
source share
2 answers

You describe the so-called scaffolding in web development. Forests are a way to automatically create user interfaces for each table in a database. Scaffolding allows you to create a functional interface for viewing and editing data based on the data schema. Here are some resources for WPF forests.

Enjoy it!

+2
source share

ASP.NET Dynamic Data uses templates to automatically create a user interface for you, which will be the tables / database views that you select, including automatically generated CRUD functions.

It even gets the lookup tables on the right and automatically displays drop-down lists.

http://msdn.microsoft.com/en-us/library/ee845452(v=vs.100).aspx

0
source share

All Articles