The ADO.NET Entity Framework is a set of Object-Relational-Mapping (ORM) tools for the .NET Framework, since version 3.5 SP1.
0
votes
3answers
22 views
Calculating total from a table that has [EffectiveDate] column
I have the following table:
[ID]
[EmployeeID]
[Status]
[EffectiveDate]
Sample Data:
ID EmployeeID Status EffectiveDate
------------------------------------------------------
...
0
votes
0answers
4 views
Entity framework and Oracle ODP.NET mapping number(1,0) to boolean AND integer
Iv been through this problem the past few hours on my .net application using entity framework, and i was unable to solve it by my self until now, I have this Oracle database with some tables that have ...
0
votes
0answers
10 views
One-to-Many EF query to get most recent row of the many
I have the following POCOs:
public class TrackToken
{
[Required, Key]
public int ID { get; set; }
[MaxLength( 500 )]
public string Comment { get; set; }
[Required]
public ...
0
votes
1answer
19 views
How do I edit a row that already exists
I'm adding a row to Videos and then I want to use that same ID as the video's physical filename. so I need to add the row without the filename, and then use the ID I get, then update that row with the ...
0
votes
0answers
40 views
Error starting program installed on a remote machine
I have a program that is installed on the server, that all users are running directly from the server. This program has run for quite some time, but now it has suddenly started to fail on startup.
...
0
votes
0answers
19 views
Map stored procedure results to entity in Entity Framework 5
I'm having a bit of trouble mapping my search results queried via a stored procedure to my EF entities. I'm using a database first approach.
I can easily use DbContext.Database.SqlQuery<T> to ...
2
votes
10answers
83 views
Operator '>' cannot be applied to operands of type 'string' and 'string' in query
In my table I have this field:
public string CARD_MANA_CONVT { get; set; }
It is a numerical field written as a string. Yep. Because in 95% of the time the value is an int, and the remaining 5%, it ...
0
votes
0answers
11 views
Filtering Related Entity
Can't seem to find an example of this. I'll express this in SQL first:
I have a parent table and a related child table which can have many rows, but I want to select all parents that meet a certain ...
0
votes
1answer
34 views
EF5 MVC4 Child/Parent navigation properties
I have 3 classes that can be the child of a multitude of parent classes. Is there a way to find the ID/Type of the child's parent class without adding a navigation property for every possible parent ...
0
votes
0answers
11 views
How to implement DbContext hiearchy
What I'd LIKE to do is manipulate EF to support plugins that access a shared database. So the database would contain all of the tables for the main application plus all of the tables required for ...
0
votes
0answers
8 views
Entity Framework Reverse Engineer Code First
I have tried to reverse engineer an existing oracle database, using the Entity Framework power tool feature. I am running to the following error trying to do so. Has any tried and accomplished this?
...
0
votes
4answers
47 views
Check to see if row exists before adding it?
I have a Certification process. Right now it will add people to my Certification table even if they already are certified for the item in question.
On my view page, I have a procedureID and there ...
0
votes
0answers
14 views
How can I update data in an entity using EF5 when the update json contains linked objects?
I have the following classes:
public partial class Content : AuditableTable
{
public int ContentId { get; set; }
public string Title { get; set; }
public string Text { get; set; }
...
1
vote
1answer
14 views
How to tell if a property of an EntityObject is a primary key or foreign key?
Suppose that I have a class generated by Entity Framework called Student.
Student has the following properties:
Id int,
Name, string
Age, int
TeacherId int
Suppose further that Id refers to the ...
-3
votes
1answer
37 views
Making C# application able to switch the use of of different DBMS at runtime [on hold]
I am making an application and I am trying to figure out how I can make this application flexible so the user can have the ability to choose which database they want to use, put in the relevant ...
3
votes
1answer
43 views
What goes in the params parameter of the .SqlQuery() method in Entity Framework?
The method takes a string for the query, and an array of Object [] for the parameters, presumably to avoid SQL Injection.
However nowhere on earth is it documented what you should put into the object ...
1
vote
1answer
12 views
Inserting Multiple Inherited Entities Gives - Unable to determine the principal end of the relationship
I'm using EF5 and I'm having an issue where I can add 1 instance of an inherited entity and save it successfully, but if I add two or more instances of the type, I run into the issue below.
These ...
0
votes
0answers
15 views
Entity framework code first multiplicity issue
I have an association table that has an additional column, so I have broken it out into two separate classes, on this table there is no primary key but they are both foreign keys to their respective ...
1
vote
2answers
46 views
Entities' does not contain a constructor that takes 1 arguments
public class Connection
{
public static string GetConecction()
{
return ConfigurationManager.ConnectionStrings["DCAssetEntities"].ConnectionString;
}
}
I have one "connection" ...
0
votes
1answer
15 views
Using EF5 to bind to Data Grid View issue
I'm new to using EF and I'm currently using EF5 to attempt to bind data from a view to my data grid view in a WinForms App. I'm not sure how to do this properly, and I'm getting an error:
Data ...
2
votes
2answers
50 views
C# safely build an SQL string to execute using Entity Framework
I'm executing some SQL using EF with the .SqlQuery(string sql) command.
I want to make sure my sql string is completely sanitised, so the logic approach was to use an SqlCommand object with ...
0
votes
2answers
44 views
How to Get Closest Location in LINQ to Entities
I am trying to get the closest location via my LINQ query:
var coord = new GeoCoordinate(loc.Latitude, loc.Longitude);
var nearest = ctx.Locations
.Select(x => new LocationResult ...
1
vote
1answer
24 views
XML Fields with Entity Framework Code First
I'm using Entity Framework with the Code First model (pet project, and I love editing simple classes and having my schema updated automatically). I have a class like follows:
[Table("Polygons")]
...
2
votes
2answers
107 views
How to avoid N+1 in EF generated queries
I used to generate all the helper tables like UsergroupUsers for many-to-many relations or relational Ids in POCO myself but now I want EF to take care of them. Now I don't think it's such a good idea ...
0
votes
2answers
48 views
Access a property of a DbSet by name
I have a DbSet<T>
I want to access one of the properties on it by name.
Is this possible?
I'm basically making a generic function, so that for any DbSet I have, I can specify a column and ...
0
votes
1answer
16 views
Generic Repository EF 5 - Update Entity And It's Complex/Scalar/Navigation Properties
I'm trying to find an easy solution for updating an entity + the included properties in my solution. I've created an Generic Repository for my DBContext (database). It does update the parent entity, ...
0
votes
0answers
17 views
Entityframework does not save Newline character (Enviroment.NewLine) in database
A strange issue I am facing with Entity Framework.
Sometimes Entity Framework does not save Enviroment.NewLine(\r\n) in database.
I have a multiline text box and when I press enter it get a new line. ...
0
votes
1answer
40 views
Code First saving of an entity with duplicate foreign keys creates multiple entites
So, below is a simplified example of what is causing me grief.
It seems like if both the enumerable ReadBooks and FavoriteBook are set before being saved to the database there is some trouble that I ...
0
votes
0answers
18 views
The name 'EntityState' does not exist in the current context
In Entity Framework, this sometimes occurs when the System.data.entity assembly is not added into the Project. But, why I didn't have this error before in other MVC project.
it occurs sometimes but ...
0
votes
1answer
15 views
Entity Framework Code First - Firebird migration: No MigrationSqlGenerator?
I'm searching for a way to update my firebird-database. I tried using migrations:
private void btnUpdateDb_Click(object sender, EventArgs e)
{
DbConnection userDBConnection = ...