简体   繁体   English

WinForms 2010数据绑定和数据库访问

[英]WinForms 2010 DataBinding and DB Access

I'm a Silverlight developer that has to work on a WinForms project again, but I'm not too excited to leave the wonderful world of data binding behind. 我是一个Silverlight开发人员,必须再次处理WinForms项目,但我并不为离开精彩的数据绑定世界而感到兴奋。 In the past I always used DataSets with SQL queries. 过去,我总是将DataSet与SQL查询一起使用。 Are there any good tutorials to update my skills? 有什么好的教程可以更新我的技能吗?

Some comments on what I want: 关于我想要的一些评论:

  • Regarding Entity Framework, it seems nice, but the last time I checked it did not handle custom situations very well. 关于实体框架,它看起来不错,但是我上次检查它并不能很好地处理自定义情况。 Is there perhaps a more hybrid customised solution where I have more control in my hands? 也许有更多的混合定制解决方案可以让我掌握更多控制权吗? For example, a custom data source with custom actions on save. 例如,具有在保存时执行自定义操作的自定义数据源。
  • I don't want to use raw text in binding lookups, and already found a useful article for Safe WinForms Databinding in C# 3 , but there are probably better standards in .NET 4. 我不想在绑定查找中使用原始文本,并且已经在C#3中找到了有关Safe WinForms Databinding的有用文章,但是.NET 4中可能有更好的标准。

Sample Form 样本表格

[ Employee Selection (Dropdown - to populate fields below, query DB on change) ] [员工选择(下拉菜单-填充下面的字段,更改时查询数据库)]
[ Employee Detail (individual fields - fairly generic) ] [员工详细信息(各个字段-相当通用)]
[ Grid (or list) with CheckBoxes for linked responsibilities (not so generic) ] [具有复选框的网格(或列表),用于链接的职责(不是很通用)]

I'm not a Silverlight developer, but as far as I know, there is not a big difference in dataBindings in Silverlight and WinForms applications. 我不是Silverlight开发人员,但据我所知, Silverlight和WinForms应用程序中的dataBindings并没有太大区别

As for ORMs (if you don't like Entity framework), you could try LINQ to SQL . 至于ORM(如果您不喜欢Entity Framework),则可以尝试LINQ to SQL The great blog tutorial is here . 很棒的博客教程在这里 But Microsoft recommends to use EF instead of LINQ to SQL in new applications. 但是Microsoft建议在新应用程序中使用EF而不是LINQ to SQL Also NHibernate is a good alternative. 同样, NHibernate是一个很好的选择。

As for exactly DataBindings in WinForms , check this post . 至于WinForms中的确切DataBindings ,请查看此文章 THen you'll be able to compare that to what you know from Silverlight. 这样,您就可以将其与Silverlight所提供的进行比较。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM