SQL Server +实体框架基础 [英] SQL Server + Entity Framework basics

查看:141
本文介绍了SQL Server +实体框架基础的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个任务在C#中创建一个管理公司员工的程序。只有简要概述 - 关于每个员工的所有信息都要存储在MS SQL数据库中。作为一个表示层,我必须使用WPF和与数据库 - LINQ to Entities的通信。

I have this task to create a program in C# for managing company's staff. Only a brief overview - all the information about each employee is to be stored in MS SQL database. As a presentation layer, I have to use WPF and as a communication with database - LINQ to Entities.

事情是 - 我设法自己学习WPF,但是SQL是一个严重的问题。我做了一些研究,但即使阅读了许多不同的教程,我还没有发现什么令人满意的。我甚至不明白这个模型的力学。我的理解是,在SQL Server中创建数据库根本不起作用,因为在从数据库创建Entity模型之后,它不再与SQL Server绑定。因此,更新创建的SQL数据库中的数据不再对程序本身有用。我可能是错的,这是非常可能的,但我只是不能得到它。

The thing is - I managed to learn WPF on my own, but SQL is a serious matter. I've done some research, but even after reading many different tutorials I haven't found anything satisfying. I don't even understand the mechanics of this model. It is my understanding, that creating a database in SQL Server simply does nothing, because after one creates Entity model from the database, it is no longer tied to SQL Server. So updating data in created SQL database is no longer of use to the program itself. I may be wrong, and that is highly probable, but I just don't get it.

所以,任何人都能指向一个正确的方向吗?我甚至还要知道什么开始?也许有一些教程为这样的noob?

So, can anyone point me to a right direction? What do I even have to know to start? Maybe some tutorials for such a noob?

推荐答案

ADO.NET实体框架(EF)首次发布与Visual Studio 2008和。 .NET Framework 3.5 Service Pack 1.到目前为止,许多人将EF视为只是来自微软的另一个ORM产品,尽管它的设计比ORM工具更强大。创建了一个新的数据访问提供程序EntityClient对于这个新框架,但在引擎盖下,ADO.NET数据提供程序仍然用于与数据库通信

ADO.NET Entity Framework (EF) was first released with Visual Studio 2008 and .NET Framework 3.5 Service Pack 1. So far, many people view EF as just another ORM product from Microsoft, though by design it is supposed to be much more powerful than just an ORM tool.A new data-access provider, EntityClient, is created for this new framework but under the hood, the ADO.NET data providers are still being used to communicate with the databases

应用程序不再直接连接到数据库或看到任何数据库特定的结构;整个应用程序根据较高级别的EDM模型操作。
这意味着您不能再使用本机数据库查询语言;不仅数据库不能理解EDM模型,而且当前数据库查询语言没有处理由EDM引入的元素(例如继承,关系,复杂类型等)所需的构造。

The application no longer connects directly to a database or sees any database-specific construct; the entire application operates in terms of the higher-level EDM model. This means that you can no longer use the native database query language; not only will the database not understand the EDM model, but also current database query languages do not have the constructs required to deal with the elements introduced by the EDM such as inheritance, relationships, complex-types, etc.

。 LINQ to Entities允许开发人员通过使用LINQ表达式和LINQ标准查询运算符,针对实体数据模型(EDM)创建灵活的强类型查询

. LINQ to Entities allows developers to create flexible, strongly typed queries against the Entity Data Model (EDM) by using LINQ expressions and the LINQ standard query operators

教程可以在此找到

这篇关于SQL Server +实体框架基础的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆