I have an Entity Framework project, and it imports a read-only view as one of the entities. This view is related to other entities, and when I attempt to update those entities, it tries to update the view also. I get the error:
Unable to update the EntitySet 'vw_Consumer' because it has a DefiningQuery and no element exists in the ...
We're developing a pretty large application with MVC 2 RC2 and we've received some feedback on the way we're using the Entity Framework's Lazy Loading.
We're just getting the entities in the controller and sending them as models to the Views, that is causing that the view code asks the Database for the navigation properties we are usin...
We are loading data from db:
var somethings = Context.SomethingSet.ToList();
Then someone deletes or adds rows outside of context. Out context still has caches deleted object, because it doesn't know they were deleted. Even if I call Context.SomethingSet.ToList(), our context still contains deleted objects and navigation properties ar...
I am using Entity Framework with MySQL. The following query results an error:
var foobar = ctx.ArticleBase.OfType<ActicleSpecial>().Include("CreatedBy.Image.Location").ToList();
Error: "OUTER APPLY is not supported by MySQL" I also get the "CROSS APPLY is not supported by MySQL" on a little different query.
I have the following datam...
Hi,
What is the best practice with regard to the Entity Framework and validating new objects prior to persisting them (or in other words calling .SaveChanges()) when the new object may rely on either persisted objects or other new objects?
For example, consider the following:
Entity1 MyEntity1 = new Entity1();
MyEntity1.Name = "Hornbl...
I am using Entity Framework 3.5. I have created an object that calls "Persons" that is inherited from SQL Membership table (aspnet_Users), they are linked by UserId (Guid) with 1-to-(0..1) relationship and they both belong to "UserSet".
Say, I have an existing "aspnet_User" called "jsmith" in the membership database already. How can...
I see examples about code-only POCO for en entity framework 4, but I cannot find the classes EntityConfiguration and ContextBuilder and I cannot see which reference I need to add to have them.
Is it part of the .Net Framework 4 or do we have to download something else?
...
When I execute the code:
public List<T> GetCustomerTxList(int customerId)
{
var matchingPocos = new List<T>();
using (linq.AOMSEntities dataRepos = new linq.AOMSEntities())
{
IEnumerable txlist = from t in dataRepos.TransactionRecord
...
Hi,
I have a very basic entity model which I'm trying to add custom validation messages to.
My metadata looks like this:
namespace My.Models {
[MetadataType(typeof(My.Models.ConsumerMetadata))]
public partial class Consumer
{
}
public class ConsumerMetadata
{
[StringLength(5)]
[Required(ErrorMessage="First name is an absolu...
Hello
Last year I developed a data access service for our project using Entity Framework (.NET3.5 of course) and using Julie Lerhman's book as a guide developed state tracking POCO objects. We use WCF and also have Silverlight 3 clients. We are moving to .NET 4.0 and I want to switch to using code generation to eliminate wasted develope...
In my example, I'm trying to create a new object which has references to existing objects. I'm finding myself having to retrieve complete objects from the database in order to reference them from my new object.
Apologies for any small errors in the code - I'm working from memory - I don't have my code with me.
My ViewModel contains th...
Hi, I need to get UserCarId(int) from this query and assign to int type variable.
int UserCarId;
Entities ctx = new Entities();
var query = from enq in ctx.UserCars.Include("aspnet_Users")
where enq.aspnet_Users.UserId == currentUserId
select enq.UserCarId ;
...
Hi, i'm using the method elementat for get a specific element of a query's result.
var mds = db.TDP_MissioniDestinazioni.Where(p => p.MissioneID == missioneRow.MissioneID);
destinazioneRow = mds.ElementAt(i);
LINQ to Entities does not recognize the method 'TimeEntModel.TDP_MissioniDestinazioni ElementAt[TDP_MissioniDestinazioni](S...
Hello guys I have the following method:
var usuario;
usuario = UniapontaService.GetUsuarioUniapontaPlanejamentoEstrategico(x => x.IdUsuario == VWUsuarioUniaponta.IdUsuario &&
x.PlanejamentoEstrategico.IdPlanejamentoEstrategico == HorarioTrabalhoCorrente.PlanejamentoEstrategico.IdPlanejamentoEstrategico...
I'm trying to wrap my head around Entity Framework 4. This is probably an easy question ;)
I have the following entities: Article, Comment and Picture. Articles have a one-to-many association with Comments. Articles have also a many-to-many relationship with Pictures.
My question is what would be the proper approach to deleting an Arti...
i have a table T with fields id, parentid, name. i make relationship with own table so parentid=>id one to many, so if parentid=null it is a parent record, and if parentid not null it is child record
after mapping i have class with 2 new properties- T1 (Collection of T) and T2 (Instance of T)
so how can i fill dropdownlistfor, if i not...
Can I generate entity framework model by clicking button in browser in client-side and save it back to web server PC?
...
Is it possible to export a sql server database (2008) to a new access database using the Entity framework (or anything else for that matter in code)?
I have developed a desktop facing application that connects to a sql sever on a server and my client wants to be able to take snapshots of the database in access to send to people who do...
I'm writing a little utility to load Entity Data Models from an assembly and query against them.
I've tried using Reflection to load a derived ObjectContext, but ObjectContext doesn't derive from MarshalByRefObject so I can't pass parameters to the constructor with Activator.CreateInstance() (according to the exception I get.)
Is it ...
The question title says it all. I need to get an instance of the application's MembershipProvider from within a controller. I have a custom membership implementation that has a custom User property that describes the logged in user. At the heart of the issue is that I need to retrieve this User object.
My application has done a skeletal...