Hi,
I have two classes; Area and LanguageArea. I use LanguageArea to handle translated Areas.
Area.cs
string Title,
string Description,
Pictures(set of Picture class),
LanguageAreas(set of LanguageArea class)
LanguageArea.cs
Language(defines which language area is translated in),
Area,
Title (translated title for the Area),
Descriptio...
Suppose I have two table tab1, tab2. EF will create a edmx file and there are two entities created.
Then I want to add a computer member to tab1, which get some result from tab2, such as count, sum. What I used is partial class:
public partial class tab1{
public int Count{
get{
int cnt;
//...
...
I'm trying to design an entity model for an application that uses ASP.Net membership for it's user authentication. In most of the database schemas I create, records typically end up related to users via the UserId field on the aspnet_users table. That's worked fine for me in the past, but now that I'm using EF, I'm having some conceptu...
Is there a generics solution for the following code?
public static int SaveReorder(IList<int> listItems)
{
int result = 0;
int order = 1;
Entity1 db = null;
using (ObjectContext context = new ObjectContext())
{
foreach (int id in listItems)
{
db = Get(c...
Hi,
I have a table structure like the following:
Companies Addresses
********* *********
ID ID
AddressID ...
BillingAddressID ...
AddressID and BillingAddressID are foreign keys which are present in the Addresses table. When I generate my model based on this table instead of getting w...
I am using Linq and the Entity Framework. I have a Page Entity, that has a many-to-many relationship to a Tag Entity.
I want to create a Linq query that pulls all pages that match all of the supplied Tags (in the form of a Int64[]).
I have tried various WhereIn, and BuildContainsExpression examples, but none are working as expected.
...
following sql query is working and gets the visits per day for the current month
select date(date) as DayDate, count(*) As visitsaday from Visits group by DayDate having DayDate between date('now','start of month') and date('now','start of month','+1 month','-1 day')
For days I try to figure out how to get this running with the entit...
How to get an average time from an Datetime field via the Entity Framework ?
How to subtract one Date from another ?
I am thinking of something like:
ObjectQuery<Visit> visits = myentitys.Visits;
var uQuery =
from visit in visits
group visit by visit.ArrivalTime.Value.Day into g
select ...
I'm tring to insert some records into my Sqlite database using the Entity Framework. I do not have a problem connecting to the database or mapping to the database. At least, I don't think I do. When I call "SaveChanges" an exception is fired that states:
Unable to update the EntitySet 'RawReadings' because it has a DefiningQuery and ...
Based on a database myDB, I generate edmx for all table and compile the project. Then I create stored procedure myProc in myDB. Then I update the model by "Update Model from database" in the node Stored Procedure and add myProc. It is fine. Then "Create a function import" on myProc. It is fine. Then I compiled the project, it is fine.
...
I'm using Mono 2.4 on the Ubiquity web hosting service.
I created a simple MVC tutioal applciation, linked here, and verified that it worked using all Microsoft tools.
Next, the application was updated to point to a MySQL server database running on my Ubiquity host. The application works great on a Microsoft based machine.
Now, I am...
What is the best way to delete an object (and its child objects) using EF? I'd like to pass just the id for the object to delete, and have EF handle deleting its dependent data (foreign key'd data). Do I have to retrieve the object first based on the id and then call "DeleteObject"?
...
Hi,
I have extended my entities to implement specific interfaces for its type. I am trying to perform the following query:
var results = from x in context.MyEntityTable
where x.AProperty == AValue
select x;
return results.Count() > 0 ? results.Cast<IApplicationEntity>().ToList() : null;
However, I kee...
what's the purpose of entity sql, i mean if you have linq to entities why would you need to write queries in string, are there any performance reasons or something ?
...
I have an inheritance hierarchy with a base Employee entity and some descendent entities for specific employee types. I need to be able to convert a base Employee entity to a more specific entity (e.g. TemporaryEmployee) and from a more specific type back to the base type (e.g. if an employee is no longer "temporary" then I want that ins...
Hi,
I have Visual Studio Team System 2008 RTM and .NET Framework 3.5 SP1.
When I try to install ADO.NET Entity Framework Tools Preview it says:
ADO.NET Entity Framework Tools Preview
can only be installed if at least one
of the following Microsoft Visual
Studio 2008 Beta 2 products is
installed: Visual Basic 2008 Beta 2
Exp...
Is there any difference between these two LINQ statements:
var query = from a in entities.A
where a.Name == "Something"
from b in entities.B
where a.Id == b.Id
select b;
var query = from a in entities.A
join b in entities.B on a.Id equals b.Id
w...
Hello
I have a problem adding entities to a collection.
public void SaveNotificationUsergroups(int bookingobjectID, int[] NotificationUsergroups)
{
BookingObject bo = _entities.BookingObjectSet.Where(b => b.BookingObjectID == bookingobjectID).First();
bo.UsergroupsBookingNotifications.Load();
int _curren...
I'm trying to update one value of a compound primary key from within the entity framework and I'm getting this error: "The property 'CustomerID' is part of the object's key information and cannot be modified. "
Here is my code:
Dim customer As Customer = (From c In db.Customer Where c.CustomerID = "xxx" AndAlso c.SiteKey = siteKey).Fi...
I am attempting to add some entities that I have created. When I try and add the entity in question to the set (see code below) I get the following error:
"The object could not be added or attached because its EntityReference has an EntityKey property value that does not match the EntityKey for this object."
I can't tell what entitykey...