Laden...

ADO.NET Entity Framework 4.X [und Language Packs]

Erstellt von MagicAndre1981 vor 12 Jahren Letzter Beitrag vor 12 Jahren 12.815 Views
MagicAndre1981 Themenstarter:in
906 Beiträge seit 2005
vor 12 Jahren
ADO.NET Entity Framework 4.X [und Language Packs]

ADO.NET Entity Framework 4.1

Overview
ADO.NET Entity Framework 4.1 introduces two new features:

The **DbContext API** is a simplified abstraction over ObjectContext and a number of other types that were included in previous releases of the ADO.NET Entity Framework. The DbContext API surface is optimized for common tasks and coding patterns.  
**Code First** is a new development pattern for the ADO.NET Entity Framework and provides an alternative to the existing Database First and Model First patterns. Code First is focused around defining your model using C#/Visual Basic .NET classes, these classes can then be mapped to an existing database or be used to generate a database schema. Additional configuration can be supplied using Data Annotations or via a fluent API.

ADO.NET team blog: EF 4.1 Released

Download:
Microsoft Download Center: ADO.NET Entity Framework 4.1

6.911 Beiträge seit 2009
vor 12 Jahren

Hallo,

cool 👍
Das ist (endlich) ein vernüftiger O/R-Mapper und auch einfach zu "bedienen", v.a. weil alles unnötige wegabstrahiert wird und wirklich persistance-ignorant gearbeitet werden kann.

Bisher hatte ich micht dem EF ja nicht viel am Hut, aber so macht es Spass. Kann also jedem der einen O/R-Mapper sucht empfohlen werden.

Danke für die Information.

mfG Gü

Stellt fachliche Fragen bitte im Forum, damit von den Antworten alle profitieren. Daher beantworte ich solche Fragen nicht per PM.

"Alle sagten, das geht nicht! Dann kam einer, der wusste das nicht - und hat's gemacht!"

3.511 Beiträge seit 2005
vor 12 Jahren

Hi,

also ich setze ja da wo es geht MS Technologien ein. Aber wenn ich sehe, das die es immer noch nicht gebacken bekommen simple Enums zu mappen, ist das eher traurig als cool 🙂. Es gehen halt immer noch nicht Dinge, die ich von einem anderen OR/M gewöhnt bin 😉

"Jedes Ding hat drei Seiten, eine positive, eine negative und eine komische." (Karl Valentin)

6.911 Beiträge seit 2009
vor 12 Jahren

Hallo,

ja das ist schon traurig das so scheinbar triviale Dinge nicht "out of the box" gehen. In Entity Framework 4.1 Code First – Mapping Enums to Lookup Tables wird ein simpler Workaround beschrieben.

die ich von einem anderen OR/M gewöhnt bin

Verräts du welchen?

mfG Gü

Stellt fachliche Fragen bitte im Forum, damit von den Antworten alle profitieren. Daher beantworte ich solche Fragen nicht per PM.

"Alle sagten, das geht nicht! Dann kam einer, der wusste das nicht - und hat's gemacht!"

1.552 Beiträge seit 2010
vor 12 Jahren

Ich bin eigentlich auch mit dem EF ziemlich zufrieden.
Ja ok, einige Sachen sind etwas umständlich wie z.B. das Cascading Delete dass OutOfTheBox nicht funktioniert (sprich wird nicht von der DB übernommen)
Bezüglich Enum: EF Feature Suggestion

Gruß
Michael

Mein Blog
Meine WPF-Druckbibliothek: auf Wordpress, myCSharp

3.511 Beiträge seit 2005
vor 12 Jahren

@gfoidl:
NHibernate.
Ich gebe zu, NHibernate ist über die Jahre erheblich gewachsen und bietet Features die schon enorm sind und wo das EF noch so einiges nachzuholen hat. Ich habe selten so ein "Framework" gesehen, welches so komplex erweiterbar ist, das man damit eigentlich (fast) alles anstellen kann. Der Umkehrschluss ist natürlich die Lernkurve. Bis man NHibernate dahingeschubst hat, bis es genau das macht was man will vergehen schon ein paar Tage 😃. Ich will das EF nicht schlecht reden. Ich finde es gut das MS (endlich) auf den OR/M Zug aufspringt und freue mich über jede neue Version. Nur wenn ich dann wieder lese das banale Dinge nicht funktionieren, gibt es immer wieder ein erheblichen Dämpfer. Deswegen bleibe ich bei NHibernate.

"Jedes Ding hat drei Seiten, eine positive, eine negative und eine komische." (Karl Valentin)

MagicAndre1981 Themenstarter:in
906 Beiträge seit 2005
vor 12 Jahren
Entity Framework Power Tools CTP1

Entity Framework Power Tools CTP1

Preview of useful design-time features for DbContext.

When right-clicking on a C# project, the following context menu function is supported:

Reverse Engineer Code First - Generates POCO classes, derived DbContext and Code First mapping for an existing database.   

When right-clicking on a file containing a derived DbContext class, the following context menu functions are supported:

View Entity Data Model XML - Displays the EDMX XML representing the underlying Code First model.  
View Entity Data Model DDL SQL - Displays the DDL SQL corresponding to the SSDL in the underlying EDM Model.  
Optimize Entity Data Model - Generates pre-compiled views used by the EF runtime to improve start-up performance. Adds the generated views file to the containing project. 

Download:
Entity Framework Power Tools CTP1

1.002 Beiträge seit 2007
vor 12 Jahren

Hallo zusammen,

Oh, and EF + Enums. Yeah, we know. It's coming 😃

m0rius

Mein Blog: blog.mariusschulz.com
Hochwertige Malerarbeiten in Magdeburg und Umgebung: M'Decor, Ihr Maler für Magdeburg

6.911 Beiträge seit 2009
vor 12 Jahren

Hallo,

leider gibt es neben den Enums noch ein paar andere Dinge die nicht so wirklich super funktionieren. Beispielsweise wenn in der Query Zeitdifferenzen berechnet werden sollen oder etwas benutzerdefiniertes als Expression<Func<>> in der Query verwendet werden soll oder SPROCs, UDFs. Es gibt zwar für alles "Workarounds" (ein schönes Wort 😉) aber mich wundert warum das in Linq2Sql möglich war und warum es MS scheinbar nicht schafft intern einen Technologie-Transfert durchzuführen. Das sollte doch möglich sein, solange sich die Expression als Standard-SQL ausdrücken lässt. 🤔

mfG Gü

Stellt fachliche Fragen bitte im Forum, damit von den Antworten alle profitieren. Daher beantworte ich solche Fragen nicht per PM.

"Alle sagten, das geht nicht! Dann kam einer, der wusste das nicht - und hat's gemacht!"

925 Beiträge seit 2004
vor 12 Jahren

Dass Expression<Func<>> in einer Query nicht (immer) geht, ist genau einer meiner persönlichen Aufreger bei EF.

2.891 Beiträge seit 2004
vor 12 Jahren

Dass Expression<Func<>> in einer Query nicht (immer) geht, ist genau einer meiner persönlichen Aufreger bei EF.

Geht doch bei LINQ2SQL ebensowenig. Geht aber leicht zu verwenden mit LinqKit.

6.911 Beiträge seit 2009
vor 12 Jahren

Hallo dN!3L,

Geht doch bei LINQ2SQL ebensowenig.

sicher? Es geht schon - siehe zB [Giagnocavo]Calling custom methods in LINQ-to-SQL

Expression<Func<>> in Linq2Sql* soll hier aber nicht weiter vertieft werden.
* ebenso wenig die korrekte Schreibweise davon 😃

mfG Gü

Stellt fachliche Fragen bitte im Forum, damit von den Antworten alle profitieren. Daher beantworte ich solche Fragen nicht per PM.

"Alle sagten, das geht nicht! Dann kam einer, der wusste das nicht - und hat's gemacht!"

2.891 Beiträge seit 2004
vor 12 Jahren

Es geht schon

Ach so... Die Expression direkt übergeben. Also Where(predicateExpression) (Und das geht nicht [immer] beim EF?)
Ich meinte sowas wie Where(a => predicateExpression(a) && ...). Das geht auch bei LINQ to SQL nicht ohne Weiteres (z.B. AsExpandable aus dem LINQKit).

925 Beiträge seit 2004
vor 12 Jahren

Ich meinte sowas wie Where(a => predicateExpression(a) && ...).){gray}

Exakt das meinte ich auch.

MagicAndre1981 Themenstarter:in
906 Beiträge seit 2005
vor 12 Jahren

Nun hast du einen Grund eine VM mit dem englischen VS2010 + Debugger Canvas + Microsoft Entity Framework June 2011 CTP zu installieren, da die Deinstallation zu kompliziert ist.

2.891 Beiträge seit 2004
vor 12 Jahren

Pff... 😄

MagicAndre1981 Themenstarter:in
906 Beiträge seit 2005
vor 12 Jahren

EF 4.1 Language Packs

A while back we announced the release of Entity Framework 4.1 (EF 4.1). Today we are making a series of language packs available that provide localized resources for EF 4.1.
What’s a Language Pack?

The language packs add a set of localized resources to an existing EF 4.1 install. Each language pack contains the following localized resources:

Intellisense files for DbContext and Code First API surface  
Once installed these are automatically picked up by Visual Studio based on your culture settings  
Satellite assembly containing localized exception messages  
Once installed the localized messages are picked up at runtime based on the culture of the executing application  
DbContext item templates for Model First &amp; Database First  
Once installed these are automatically picked up by Visual Studio based on your culture settings  

What Languages?

Language packs are available in the following languages:

Chinese (Simplified)  
Chinese (Traditional)  
French  
German  
Italian  
Japanese  
Korean  
Russian  
Spanish  

Installing Language Packs

You can install one or more language packs by downloading a
>
, the language packs require you to have EF 4.1 installed.

MagicAndre1981 Themenstarter:in
906 Beiträge seit 2005
vor 12 Jahren

EF 4.1 Update 1 Released

What’s in Update 1?

Update 1 includes a small set of changes including:

Bug fix to remove the need to specify ‘Persist Security Info=True’ in the connection string when using SQL authentication. In the EF 4.1 release ‘Persist Security Info’ was required for Code First to be able to create a database for a connection using SQL Authentication. The update includes a fix to remove this requirement. Note that ‘Persist Security Info’ is still required if you construct a DbContext using a DbConnection instance that has already been opened and closed.  
Introduction of new types to facilitate design-time tools for Code First. Update 1 introduces a set of types to make it easier for design time tools to interact with derived DbContexts:  
    DbContextInfo can be used to instantiate and interact with a derived context as well as determine information about the origin of the connection string etc..  
    IDbContextFactory&lt;TContext&gt; is used to let DbContextInfo know how to construct derived DbContext types that do not expose a default constructor. If your context does not expose a default constructor then an implementation if IDbContextFactory should be included in the same assembly as your derived context type.

Download

MagicAndre1981 Themenstarter:in
906 Beiträge seit 2005
vor 12 Jahren

Code First Migrations: August 2011 CTP Released

Back in April we announced the release of Entity Framework 4.1 (EF 4.1). The most consistent request we have heard from you since releasing EF 4.1 has been for a migrations solution for Code First that will incrementally evolve the database schema as you model changes over time. Today we are announcing the release of our first Community Technical Preview (CTP) of our Code First Migrations work.

This initial CTP is primarily focused on the developer experience inside of Visual Studio. We realize this isn’t the only area in which migrations is important and our team is also working on scenarios including team build, deployment and invoking migrations from outside of Visual Studio as well as from custom code.

You may be wondering why we are releasing the ‘August 2011 CTP’ in July 2011… we were so eager to get the release in your hands we ended up shipping early!

This initial CTP is available via NuGet as the EntityFramework.SqlMigrations package.

Prerequisites & Incompatibilities

Migrations is dependent on EF 4.1 Update 1, this updated release of EF 4.1 will be automatically installed when you install the EntityFramework.SqlMigrations package.

Issues & Limitations

We really wanted to get your feedback early in the release cycle so this CTP hasn’t been polished and isn’t a complete set of the features we intend to ship.

Some known issues, limitations and ‘yet to be implemented’ features include:

** :::

**There is no provider model, this release only targets SQL Server**, including SQL Azure. SQL Compact and other providers are not supported. We are currently working through what the provider model should look like for migrations.  
**All existing tables will be re-built during first migration**. The components we are using for schema comparison are overly sensitive to things such as ANSI_PADDING. This often results in tables being rebuilt when you swap to using migrations to maintain the schema. We are working on removing this behavior.  
Extra database constructs, such as indexes, can not be added in custom scripts. If you add an index in a custom script it will be removed by the next automatic upgrade. This is a limitation of this first CTP and we intend to change this behavior.  
Migrations is overly sensitive to column ordering and will re-build a table to insert a column in the correct order. We intend to make this behavior customizable.  
The custom scripts that migrations scaffolds are verbose and include a lot of additional SQL that is not required. We are working to tidy these up so that they only include the core commands.  
Migrations currently needs to run in full trust. This isn’t an issue when working inside of Visual Studio but if consuming the migrations assembly from custom code you may want to run in medium trust. We are looking at ways to support this in a later release.  
**This release is only available via NuGet.** As we support more scenarios such as team build and an ‘outside of Visual Studio’ command line experience we will also support more installation options.  
There is a known issue that may result in a “The project &#39;&lt;project name&gt;&#39; does not contain or reference any contexts.” error message. This issue occurs when your context is defined in a referenced project and NuGet&#39;s Package Manager Console (PMC) is initialized before your solution is loaded. If you encounter this behavior, close PMC and restart Visual Studio taking care not to reopen PMC until after your solution has loaded.  
The performance of migrations is not ideal in this preview and we are working to improve performance for upcoming releases.  
Previewing changes via the ‘–Script’ option only works after the schema has been upgraded at least once using migrations. If you haven’t used migrations on the database you will just get a create script for the entire database when using ‘-Script’.  
Downgrade is currently not supported. When generating custom scripts you will notice that the script is named ‘Up.sql’ but there is no corresponding ‘Down.sql’. We are planning to add downgrade functionality prior to RTM but it is not available in this release.

Quelle:
ADO.NET team blog