Hi,
I have a Article and Blog tables that I want to represent as a Content Entity. I have mapped both tables to the Content entity however when I query using a ObjectSet.Take(20) only the article table is being hit in the dbase. Am i wrong in thinking (hoping) the query should look where contentType = 1 and 2?
Ta
SQL query looks like ...
How can you change the schema that is defined in the ssdl files generated by the Entity Framework at runtime? I understand that this is not support out of the box and I don't want to use any external projects (like the one suggest here).
...
I have inherited a medium sized database that we are trying to use with Entity Framework in a MVC2 rewrite we are working on. We used the existing database to generate the data model (.edmx file) and all was good. Until I realized that I could not use the dot notation access all the fields.
appointment.Employee.name // works fine
app...
I have this function:
public static IQueryable<Article> WhereArticleIsLive(this IQueryable<Article> q)
{
return q.Where(x =>
x != null
&& DateTime.UtcNow >= x.PublishTime
&& x.IsPublished
&& !x.IsDeleted);
}
And it works just fine in this query:
from a in Articles.WhereArticleIsLive()
where a.Id ==...
Is it possible somehow to do multiplie one-to-many relationships between 2 tables?
Like:
Table abc
abcID
defID
message
Table def
defID
abcID
message
If yes how can I then make a new abc entry with the entity framework?
...
As a follow on from this question I'm building a custom server control to be placed on a Sharepoint 2010 master page.
The idea behind this is that it will display a menu that is dynamically populated from the database.
As this is a server control, I'm building it in a dll but I've run into a small snag. As it has to connect to the data...
Hey guys,
I have created a conceptual entity in my EF model called Task. Then I imported the INSERT, UPDATE, DELETE stored procedures into my model and mapped them to Task.
In my client code, I have something like this:
myModel.AddToTasks(new Task(...));
myModel.SaveChanges();
However, it gives me a NullReferenceException from Ens...
In RIA services the EntityCollection<T> class is defined as follows :
public sealed class EntityCollection<TEntity> : IEntityCollection,
IEnumerable<TEntity>,
IEnumerable,
INotifyCollection...
I generated the EDMX file through Visual Studio 2010, I have two tables namely PersonalDetail and Address, In the personalDetail table, i have two fields namely officeaddress and residenceaddress. Both have the relationship with "Address", so while generating the EDMX file , i getting two entities like Address and Address1, but i want to...
I am struggling already several days to solve my problem with primary key usage. Please, someone help me to solve this puzzle!!!
I am using Entity Framework with CTP4 using Code First approach. I adopted for my project Repository pattern published by Huyrua see here. I am very exited with this patern and with CTP4 possibilities in parti...
Afternoon all,
I am attempting to filter a WPF Listbox control which is bound to a collection of Entity Framework objects.
I am running into a problem which I cannot find much help on:
Firstly I am creating a BindingListCollectionView and then set its DefaultView to my collection of entity objects db.Users.
BindingListCollectionView...
I have the following model:
public class Product {
public int Id { get; set; }
public string Name { get; set; }
private int CategoryId { get; set; }
public Category Category { get; set; }
public string InventoryDetails { get; set; }
}
I have an action in my controller which is used to create a new product. My question is how to l...
I'm looking at a project that has been developed and maintained with Entity Framework 1 that is relatively stable at this point. I'm wondering if people have ever migrated a project like that to EF 4 and if anyone can share any particular difficulties they may have had. I know there are a lot of benefits to look forward to but I'm tryi...
Hello all, I am trying to put together a simple POC for a n-layer application using EF4 in the data tier. I have looked at numerous examples on the web and it seems to be a common practice to use a DAO or a Repository as the wrapper to an ORM. My understanding that the main difference between the two is that a Repository is more generi...
Hi,
I have a legacy database which has two collumns and I want to map them as 1 ID is this possible
for example
public class Product
{
public string ProductID {get;set;}
public string ShortDescription {get;set;}
public string UserName {get;set;}
}
then my Modelbinder looks like this
modelBinder.Entity<Product>().
HasKey(p=>p.P...
Hi I am trying to use a stored procedure as an imported function in an entity sql statement
See my statement below, but this does not seem to work and I'm having a hard time finding out how imported functions are used in Entity SQL
SELECT
Cp.Calendar_Reference
FROM
Model.Calendar("CY", DATETIME'1999-01-01 00:0:00', DATETIME'2009-01-0...
I have a test bed that I created while evaluating EF4's Self Tracking Entity capabilites vs our current ORM tool (LLBLGen Pro). One of our usage scenarios produced significant performance differences. EF4 in general looked very promising, but this potential performance problem (and concern raised by it) make me very reluctant to sign u...
I'd like to pass around a custom IQueryable object to repository methods. Example:
// a fake query to generate an expression
public class MockQuery<T> : IOrderedQueryable<T>
{
// implement my own query provider internally
}
public class EFRepository : IRepository<MyType>
{
public IList<MyType> ExecuteQuery(IQueryable<MyType> ...
Hi Guys,
I am having a real issue with the EF v1. I have quite a big EDMX with maybe 50 entitys mapped, but this one entity is causing me grief. The entity has mappings to other entitys with in effect are reference tables, but for some reason it is trying to do an Insert and not just update its self. Here is a fragment of my code..
usi...
Having a EF Context and a Testenity I want to get the following test to work.
TestEntity testEntity = new TestEntity() { Name = "Hello World" };
context.TestEntities.AddObject(testEntity);
// missing Code
Assert.AreEqual(1, context.TestEntities.Count(), "Entity not in context!");
I know that it works with SaveChanges() but I do not w...