After some NullReferenceException headache from deep down System.Data.Services I found out that data services doesn't like properties in the EF model marked as protected.
The exception occurs when the data service is initializing and tries to generate metadata for the EF model. Apparently Microsoft decided to throw a NullReferenceExcept...
I prefer working with DateTime.MinValue, even if I use SqlServer as backend.
Is it possible to make EntityFramework to convert from DateTime.MinValue to 1753-01-01 when saving entities and convert back to DateTime.MinValue when fetching them?
Edit: I do not want to use DateTime? (nullable value type)
...
I'm trying to convince my client to use nhibernate instead of Entity Framework 4. My client have decided to use only Microsoft libraries (including Unity and Enterprise library 5). I don't agree with them (there are so much better logging frameworks/validation layers/ioc etc) but respect their decision.
I've played with EF4 for a couple...
I am attempting to perform the LoadProperty operation from my context to load a navigation property of a navigation property.
My setup is that I have an EntityA, which contains a list of EntityB's, and each EntityB contains a list of EntityC's. I am doing the following programatically:
public virtual List<T> LoadProperty(List<T> entiti...
Function Edit(ByVal id As Integer) As ActionResult
Dim entities As New Deployment_devEntities()
Dim w As System.Data.Objects.ObjectQuery(Of tblWebsites) = entities.CreateQuery(Of tblWebsites)("SELECT VALUE m FROM tblWebsites as m WHERE m.WebsiteID = " & id)
Dim q = From m In entities.tblWebsites Where m.We...
Hi Guys,
I'm trying to integrate nopCommerce into a third party system but am hitting a problem when I try to access any nopCommerce pages. Because I'm integrating with a third party system I've had to merge web.configs and copy all files over. I have a standalone install of nopCommerce aswell and that is running fine.
Any help would b...
I have a database, and I have entity POCO's, and all I want to use EF for is to map between the two and keep track of changes for loading, saving, etc.
I have been reading a lot of the literature (such as it is) on "Code First", and I am unclear on how much of the database information I need to supply when there is not going to be a dat...
The Entity Framework 4 is driving me mad, This situation is:
Employee entity - many to many association - Department entity
I get employees from the EmployeeRepository and Departments from the DepartmentRepository. Each repository uses its own data context. My UI has a list of departments (from the DepartmentRepository) to select for ...
How to declare a one to one relationship using Entity Framework 4 Code First (POCO)?
I found this question http://stackoverflow.com/questions/2089395/one-to-one-relationships-in-entity-framework-4-v2-with-poco, but the article that the answer references was not useful (there is one line of code that is a 1-1 relationship, but no mention...
Hello,
I've been trying to implement a custom ORM for our project and am interested to learn how LINQ to SQL or Entity Framework lazy load objects.
I read some about EntitySet and realized it has a Load() method. Does anyone know how exactly Load works? I'm assuming it should have a reference to DataContext (or ObjectContext in EF) t...
I use EntityFramework POCO + proxies + lazy loading in my project. Today I was pretty surprized to see that the class Transaction has its related collection Rows materialized into HashSet (instead of EntityCollection). I need EntityCollection for tracking changes in the collection.
public class Transaction
{
public virtual ICollecti...
I'm just getting into Entity Framework 4, and was eventually hoping to wrap it in a repository pattern using POCOs. I discovered something that I wasn't expecting though. It appears that if you create a context, add an object to it (without saving the context) and query the context again, it doesn't include the new object in the results....
I am using ActiveSync with the Entity 4.0 framework. Everything is working fine except that after the ActiveSync posts updates to the server, it then tries to download those same record updates back to the client. This triggers key constraint errors, as it should.
The only changes I have made is deleting all the ActiveSync fields from t...
Hello,
I am implementing an ObservableCollection to manage my EF entities. When i want to edit some entity, i create a clone of the entity and i open it up inside a popup window. When the user finishes to edit the cloned entity, i proceed to detach the original entity and then attach the new (cloned and edited) entity.
No exception occ...
i have a 2 tables in db . Person and child
they are hirarchy it means my child table has an Id that is PRIMARY KEY but not auto inceremental.this Id fill by Id of Parent table
i have created a EDMX from these
but when i wanna save a child i cant see the fields of parent in my child class
in EF its not supported ?
i wanna does it like N...
Hi all.
Plz help.
I have this query and its result implements IEnumerable.
RoutesEntities routesModel = new RoutesEntities();
LocalesEntities localesModel = new LocalesEntities();
var routesQuery = from rs in routesModel.Routes.ToList()
join ls in localesModel.Locales.ToList()
on rs.LocaleID equal...
I am designing my first Layered Application which consists of a Data, Business, and a Presentation layer.
My business components (e.g, Business.Components.UserComponent) currently has the following method:
public void Create(User entity)
{
using (DataContext ctx = new DataContext())
{
ctx.Users.AddObject(entity);
...
I have the following stored procedure:
CREATE PROCEDURE GetSequenceNextValue(IN sequenceName VarChar(100))
BEGIN
UPDATE Sequences Set currentValue = LAST_INSERT_ID(CurrentValue + 1) WHERE name = sequenceName
SELECT LAST_INSERT_ID();
END
But when I update my model, this procedure is not imported even into storage model.
...
Hello, I beginning a new project and I need to create a Project for implementing Entity Framework 4.0 and Unity Framework 2.0 along with Enterprise Library 5.0.
I am very new to Entity Framework and Unity Framework and getting confused in how I can get normal Object BO's and DAL with Database.
Can someone point me to some simple exampl...
I've written a 2-tier C# asp.net application. Everything works OK, but if I modify the SQL Server data using the management console, the changes are not displayed on screen. It seems the application reads the data from a cached instance.
I have tried everything to make sure it's not a browser cache issue... the data remains static until ...