Suppose I have
table Person
table Employee, which inherits Person.
I want to get a list of Person only. How do you get entity framework to do that without joining the Employee table?
Hello, is there any sample projects that I can download that shows alot of interaction with the entity framework and the mvc pattern of asp.net?
It should have stuff such as:
CRUD
CRUD on child records
Relationships
Inheritance
Thank you.
I had to get a new machine recently. It is Windows 7, loaded with Studio 2008, with Framework 3.5 sp1. When I load pre-existing projects that use the Entity Framework, the projects don't recognize the .edmx files. Any ideas?
Hello
I wanted to know if there are any paid or free named entity recognition web services available.
Basically I'm looking for something - where if I pass a text like:
"John had french fries at Burger King"
It should be identify - something along the lines:
Person: John
Organization: Burger King
I've heard of Annie from GATE - but I dont think it has a web service available.
Thanks
Hi Everyone
Is it possible to create the database from the classes with entity framework 4.0? I found many tutorials on how to do it the other way round. But since we have already implemented and tested all classes of the domain we'd like to avoid changing them to much.
If I used the wrong keywords in Google I'd appreciate you could post a link.
Cheers,
CA
We want to use the Entity Framework (.NET 4.0) to build applications that can deal with Sql Server, MySQL and Oracle. And maybe Sqlite too.
It should be easy to switch the db vendor by some setting in a config file.
Is this possible? I prefer real life examples!
What kind of providers did you use?
Hey guys,
I wanted some help with trying to implement a simple polymorphic relationship using Entity Framework.
An example of a relationship I would like to implement:
Comment table
ItemType ('Video', 'User')
ItemID
Body
Video has many Comments
User has many Comments
No idea the best way to do this, I come from a Ruby on Rails way of thinking.
I am using Entity Framework v4. I have created a POCO class that contains a bunch of scalar properties and a collection that returns an Interface type. How do I create this relationship in the EF model? How do I show a collection that contains different items but they all have a common interface?
I'm been looking around and trying to see if the Entity Framework 4 will run under Visual Studio 2008, but can;t find any references to it.
Can you get EF4 working on VS2008?
Hi,
My UPDATE and DELETE logic are in stored procedures. I've built an entity framework model with mappings to these procedures.
In spUpdate I return the new timestamp column so the EF could detect concurrency conflicts. It works fine.
I have a problem with the spDelete because I don't see mappings for return values in the "delete function" row.
How to check concurrency in this example?
I'm brand new to the Entity Framework and trying to learn all it can offer. I'm currently working my way through the MVC Music Store tutorial which includes the following code:
public ActionResult Browse(string genre)
{
// Retrieve Genre and its Associated Albums from database
var genreModel = storeDB.Genres.Include("Albums")
.Single(g => g.Name == genre);
return View(genreModel);
}
as I'm working in VB I converted it like so:
Function Browse(ByVal genre As String) As ActionResult
'Retrieve Genre and its Associated Albums from database
Dim genreModel = storeDB.Genres.Include("Albums"). _
Single(Function(g) g.Name = genre)
Return(View(genreModel))
End Function
The problem is I'm getting the following exception:
Invalid column name 'GenreGenreId'.
Which I know is true, but I can't for the life of my work out where it's getting 'GenreGenreId' from. Probably a basic question but I'll appreciate any help in the right direction.
As per requested here is the source for my classes:
Album.vb
Public Class Album
Private _title As String
Private _genre As Genre
Private _AlbumId As Int32
Private _GenreId As Int32
Private _ArtistId As Int32
Private _Price As Decimal
Private _AlbumArtUrl As String
Public Property Title As String
Get
Return _title
End Get
Set(ByVal value As String)
_title = value
End Set
End Property
Public Property AlbumId As Int16
Get
Return _AlbumId
End Get
Set(ByVal value As Int16)
_AlbumId = value
End Set
End Property
Public Property GenreId As Int16
Get
Return _GenreId
End Get
Set(ByVal value As Int16)
_GenreId = value
End Set
End Property
Public Property ArtistId As Int16
Get
Return _ArtistId
End Get
Set(ByVal value As Int16)
_ArtistId = value
End Set
End Property
Public Property AlbumArtUrl As String
Get
Return _AlbumArtUrl
End Get
Set(ByVal value As String)
_AlbumArtUrl = value
End Set
End Property
Public Property Price As Decimal
Get
Return _Price
End Get
Set(ByVal value As Decimal)
_Price = value
End Set
End Property
Public Property Genre As Genre
Get
Return _genre
End Get
Set(ByVal value As Genre)
_genre = value
End Set
End Property
End Class
Genre.vb
Public Class Genre
Dim _genreId As Int32
Dim _Name As String
Dim _Description As String
Dim _Albums As List(Of Album)
Public Property GenreId As Int32
Get
Return _genreId
End Get
Set(ByVal value As Int32)
_genreId = value
End Set
End Property
Public Property Name As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
End Set
End Property
Public Property Description As String
Get
Return _Description
End Get
Set(ByVal value As String)
_Description = value
End Set
End Property
Public Property Albums As List(Of Album)
Get
Return _Albums
End Get
Set(ByVal value As List(Of Album))
_Albums = value
End Set
End Property
End Class
MusicStoreEntities.vb
Imports System.Data.Entity
Namespace MvcApplication1
Public Class MusicStoreEntities
Inherits DbContext
Public Property Albums As DbSet(Of Album)
Public Property Genres As DbSet(Of Genre)
End Class
End Namespace
I've had an entity framework model working for some time. Yesterday, it suddenly started complaining about a foreign key relationship issue during an insert. I've checked the fields and can do a manual insert using the exact field values. But the EF continues to complain. Any ideas what could have happened?
Is it possible to pass a SQL script to some method that Entity Framework has to run it against my model? e.g. equivalent of:
context.ExecuteStoreCommand(<tsql script path>);
Background: I want a way to reset the database during unit tests, and making a call to run the EF generated TSQL script (from Generate Database from Model) seems one way to achieve this.
Hello All:
I am using entity framework 3.5 for my application.
I want load data based on some condition e.g.
var data = from e in context.Employee.Include("Employee.Projects") where e.IsActive select e;
Using this, I will get all the Employees which are active with their project details. But I want to load only those projects which are active. So, how to load only active projects using the query?
Thanks
Ashwani
Any experiences on how to document Entity Framework 4 based Database projects?
There is the Document and Summary properties on the Entities, but if we want to regenerate the model from the database at some point, it will be lost!
Is there some way to map documentation data inside SQL to the Entities in the EDMX file so it is safe.
Suggestions of other best practices? Ideally I want to be able to augo generate html/helpfile documentation from the DB when we deploy.
Can someone point me to a good tutorial explaining the Entity Framework using an XML file instead of a database?
I have seen some good tutorials with SQL databases, but I can't make the leap to an XML file.
Thanks!
Hi,
In Entity Framework (VS2010) how do I create an association to/from the same table? (a many-to-many is what I want)
Background - I was expecting under the bonnet a NODE and RELATIONSHIP table, where the latter has a parent_node_id and a child_node_id (i.e. pointing back to the NODE id column). I can't seem to get the designer to add it...
Having played with Linq (to SQL and Objects) as well as the Entity Framework from Microsoft recently, I was wondering what the non-.Net (specifically Java) equivalents are?
So I'm starting to look into EF and POCO.
From my understanding, the entity generated by EF is not pure POCO since it inherit from EntityObject.
But are they PI? It seem to me that they don't have any persistence awareness in them, or there is something in the EntityObject that makes them PI?
Hello Guys!
I'm mapping a set of tables that share a common set of fields:
So as you can see I'm using a table-per-concrete-type strategy to map the inheritance.
But...
I have not could to relate them to an abstract type containing these common properties.
It's possible to do it using EF?
BONUS: The only non documented Entity Data Model Mapping Scenario is Table-per-concrete-type inheritance http://msdn.microsoft.com/en-us/library/cc716779.aspx : P
Let's say we have the "EntityCollection products".
Then the following doesn't work:
foreach (var product in products)
{
product.LastUpdate = DateTime.Now();
}
As you can also not index an EntityCollection, how do you modify an entity in en EntityCollection?
I have an 'overlay.dtd' file with a line like <!ENTITY myentity "myvalue">.
At the top of my xul file I have <!DOCTYPE overlay SYSTEM 'chrome://myaddon/locale/overlay.dtd'>.
In my xul file, I have <script src='myscript.js'>.
I want to know if there is any way to access 'myentity' from the script.
alert("&myentity;") just alerts "&myentity;"