用于Windows桌面应用程序的EF Core :)

编程入门 行业动态 更新时间:2024-10-18 16:53:20
本文介绍了用于Windows桌面应用程序的EF Core :)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用WPF开发Windows桌面和使用VS 2017的EF 6.13

i am developping a windows desktop using WPF and EF 6.13 with VS 2017

在我的解决方案中我有一个类库项目是我的DAL,使用EF dbfirst EDMX来访问我的数据。

in my solution i have a class library project wich is my DAL and that use EF dbfirst EDMX to access my data .

现在新的EFCore真的很诱惑我出于各种原因......

now the new EFCore is really tempting to me for various reasons ...

是否可以用一个使用EFCore的新项目替换我的DAL项目?我可以先使用代码...

is it possible to replace my DAL project with a new one that use EFCore ? it's ok for me to use code first ...

另请注意,我在这个项目的Windows上专门开发。

also please note that i develop exclusively on windows for this project .

欢迎任何关于我能做什么的想法,谢谢

any idea on what i can do is welcome , thanks

推荐答案

你好issam1975,

Hi issam1975,

>>是否可以用一个使用EFCore的新项目替换我的DAL项目?我可以先使用代码...

>>is it possible to replace my DAL project with a new one that use EFCore ? it's ok for me to use code first ...

是的,但是,EF Core是一个新的代码库,并不像EF6那样成熟。

Yes, it is, but EF Core is a new code base and not as mature as EF6.

>>欢迎任何关于我能做什么的想法,谢谢

>>any idea on what i can do is welcome , thanks

这是目前未在EF Core中实施的功能列表,可能会影响您的使用能力它在给定的应用程序中。这绝不是可能的O / RM功能的详尽列表,但我们认为这些功能对开发人员的影响最大。 +

This is a list of features not currently implemented in EF Core that are likely to impact your ability to use it in a given application. This is by no means an exhaustive list of possible O/RM features, but the features that we feel have the highest impact on developers.+

  • 创建模型

  • Creating a Model

  • 复杂/值类型是没有主键的类型,用于表示实体类型的一组属性。
  • 可视化模型查看基于代码的模型的图形表示。
  • 简单类型转换,例如string => xml。
  • 空间数据类型,例如SQL Server的 geography & 几何。
  • 多对多关系没有加入实体。您已经可以使用连接实体建模多对多关系,请参阅 关系有关详细信息。
  • 关系数据库的备用继承映射模式,例如每种类型的表(TPT)和每种具体类型的表(TPC)。已支持每个层次结构的表(TPH)。
  • Complex/value types are types that do not have a primary key and are used to represent a set of properties on an entity type.
  • Visualizing a model to see a graphical representation of the code-based model.
  • Simple type conversions such as string => xml.
  • Spatial data types such as SQL Server's geography & geometry.
  • Many-to-many relationships without join entity. You can already model a many-to-many relationship with a join entity, see Relationships for details.
  • Alternate inheritance mapping patterns for relational databases, such as table per type (TPT) and table per concrete type (TPC). Table per hierarchy (TPH) is already supported.

查询数据

  • 改进了翻译以使更多查询成功执行,在数据库中评估更多逻辑(而非内存中)。
  • GroupBy转换特别是将LINQ GroupBy运算符转换为数据库而不是内存。
  • 延迟加载可以自动填充导航属性访问它们时的数据库。
  • 非模型类型的原始SQL查询允许使用原始SQL查询来填充不属于模型的类型(通常用于非规范化)视图模型数据。。
  • Improved translation to enable more queries to successfully execute, with more logic being evaluated in the database (rather than in-memory).
  • GroupBy translation in particular will move translation of the LINQ GroupBy operator to the database, rather than in-memory.
  • Lazy loading enables navigation properties to be automatically populated from the database when they are accessed.
  • Raw SQL queries for non-model types allows a raw SQL query to be used to populate types that are not part of the model (typically for denormalized view-model data).

保存数据

  • 简单命令拦截提供了一种在将命令发送到数据库之前/之后读取/写入命令的简便方法。
  • 存储过程映射允许EF使用存储过程来持久更改数据库( FromSql 已经为使用存储过程查询提供了很好的支持,请参阅 Raw SQL Queries 了解详情。)
  • Simple command interception provides an easy way to read/write commands before/after they are sent to the database.
  • Stored procedure mapping allows EF to use stored procedures to persist changes to the database (FromSql already provides good support for using a stored procedure to query, see Raw SQL Queries for details).

数据库架构管理

  • 逆向工程的Visual Studio向导允许你从现有数据库创建模型时可视化配置连接,选择表等。
  • 从数据库更新模型允许以前从数据库进行逆向工程的模型使用对架构所做的更改进行刷新。
  • 种子数据允许将一组数据轻松插入数据库。
  • Visual Studio wizard for reverse engineer that allows you to visually configure connection, select tables, etc. when creating a model from an existing database.
  • Update model from database allows a model that was previously reverse engineered from the database to be refreshed with changes made to the schema.
  • Seed data allows a set of data to be easily upserted to the database.

有关详细信息,请参阅:

For more information, please refer to:

docs.microsoft/en-us/ef/ efcore-and-ef6 / features

您也可以参考以下文档开始使用。

You could also refer to the following document to get started.

docs.microsoft/en-us/ef/core/get-started/

祝你好运,

Cole

更多推荐

用于Windows桌面应用程序的EF Core :)

本文发布于:2023-11-07 15:14:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566795.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   桌面   Windows   EF   Core

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!