I have an entity generated from my database that contains one table. When i make changes in the DB i obviously would like these changes to reflected in my model.
My current approach is to delete the item from the designer and then right-click - update model from database. This works for me at the moment. Is there a different approach t...
This is not a duplicate of this post although the title is very similar. I am using EF4 with MSSQL Express 2008 R2 on VS2010.
A simplified version of my schema is as follows:
Table [Team]:
Id (PK)
Member1
Member2
Table [Person]:
Id (PK)
FirstName
[Team].Member1 and [Team].Member2 are foreign keys pointing to [Person].Id.
When ...
Let's say that I had a SQL Server database with a table called MyValues and a column called ValueA defined as decimal(7,4) and I created an Entity Framework 4 model from that table within Visual Studio 2010. The result would be an entity called MyValue with a Decimal ValueA property having a Precision set to 7.
If I go into the databas...
Given a "User" table and a "Login" table in MS SQL 2008:
CREATE TABLE [dbo].[User_User](
[UserID] [int] IDENTITY(1000,1) NOT NULL,
[UserName] [varchar](63) NOT NULL,
[UserPassword] [varchar](63) NOT NULL
)
CREATE TABLE [dbo].[Util_Login](
[LoginID] [int] IDENTITY(1000,1) NOT NULL,
[User_UserID] [int] NOT NULL, -- FK ...
I am using RIA Services with Silverlight and Entity Framework. I want to call a stored procedure and map the results to a datagrid. What is the best way to do this? The output of the stored procedure doesn't map to any table design.
I found the following article -
http://blogs.msdn.com/b/tom/archive/2009/05/07/silverlight-ria-calling-...
public List<Store> GetAllFriendsTopStores(long uid, List<long> users)
{
using (var entities = new myEntities()) {
var v = entities.DbUsers
.Where( x => users.Contains( x.uid ))
.Stores // i can't select stores here? Why is this???
}
}
In this case Stores is a navigation property... I need to be ...
I have a bunch of Linq to Entity methods that had the same select statement, so I thought I would be clever and separate that out into it's own method to reduce redundancy... but when i attempted to run the code, i got the following error...
this method cannot be translated into
a store expression
Here is the method i created...
...
Hi everyone,
Let say we have a class
Category
{
ID,
Name,
ParentID
}
and a List
1, 'Item 1', 0
2, 'Item 2', 0
3, 'Item 3', 0
4, 'Item 1.1', 1
5, 'Item 3.1', 3
6, 'Item 1.1.1', 4
7, 'Item 2.1', 2
Can we using LINQ to render a tree like:
Item 1
Item 1.1
Item 1.1.1
Item 2
Item 2.1
Item 3
Item 3.1
Any helps is appreci...
Using Entity Framework with MVC2, I have a series of date textboxes, that I want to display data from the model in a short date format, but I have to use Html.TextBoxFor in order for the update code to work (Having tried using HTML.Textbox the data never gets saved to the model).
<%: Html.TextBoxFor(model => model.Item.Date, String.For...
Hi!
I'm writing a custom .NET MembershipProvider (not the built in one) and trying to update using Entity Framework. But of course i have no access to (Try)UpdateModel. How can i update it? Thanks in advance.
...
SQL Server Compact does not support identity column when it is used with the Entity Framework so I must generate the identity value manually. I did as follows:
DatabaseEntities de = new DatabaseEntities();
Income income = new Income();
income.Id = de.Incomes.Max(f => f.Id) + 1;
income.Time = DateTime.To...
I am going to use Entity Framework and WCF in my application. The suggested practice, as I saw, is using POCO with Entity Framework and also using POCO classes as DataContracts. That is actually what POCO and Attributes are used for, -if I am not wrong.
However I am asked to use seperate classses for Entity Framework POCO's and WCF Data...
I am getting these "System.Data.SqlClient.SqlException" exceptions during peak hours on a high-traffic website (ASP.NET).
The full exception:
SomeMethodName
- Ex.Type: System.Data.UpdateException - Ex.Source: System.Data.Entity
- Ex.Message: An error occurred while updating the entries. See the inner exception for details.
- Ex.S...
I have a model set up using LINQ to Entities and have code working that adds to the database as expected. However, I can't get UpdateModel to work when I am using .NET 3.5.
[HttpPost]
public ActionResult Edit(Site.Models.XYZ xyz)
{
try
{
var original = db.XYZ.First(u => u.id == xyz.id);
UpdateModel(original);
...
If column allow does not allow NULL in db then a condition in setter of generated property in Entity Framework is if (_ColumnName != value)
What is the use of this?
Why this condition is missing in setter generated from columns which allow NULL?
[EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
[DataMemberAttribut...
Although I believe I have a good grasp on MVC (from Rails), I'm learning the "MS Way" with ASP.NET MVC.
Also, I am learning Entity Framework as well.
I've created an Entity called User in my Models folder. Using LINQ to EF I can retrieve records and all is good.
Now, I want to put some business (or what I call, domain) logic in. But...
Hello, guys!
In my project I'm using EntityFramework 4 for working with data. I found horrible performance problems with a simple query. When I looked at the profiler on a sql query, generated by EF4, I was shocked.
I have some tables in my entity data model:
It looks pretty simple. I'm trying to select all product items from specif...
I have a string property on an entity with a Max Length property of 13. I can easily assign a value with length 15 to this property and only find out when I try and save changes to the database. I can see no attributes on the generated property code that indicate a max length either. What is this field for and how do I use it?
...
am getting this error on this code (this is an MVC project into which I am trying to integrate Entity Framework):
List<string> consultantSchoolList = new List<string>();
// districts managed by consultant
IQueryable<string> consultClients = rc.consultantDistrictsRepository.districtsForConsultant(userID);
...
This is a tough one because not too many people use Pex & Moles or so I think (even though Pex is a really great product - much better than any other unit testing tool)
I have a Data project that has a very simple model with just one entity (DBItem). I've also written a DBRepository within this project, that manipulates this EF model. R...