Hi 'overflow!
I'm having a bit trouble inserting into a mssql database using Entity Framework. There's two tables that I want to insert into, where one of table 1s fields is a foreign key in table2.
This is the code I have so far:
Media media = null;
foreach(POI p in poiList)
{
media = new Media()
{
Path = p.ImagePath...
Hello.
I'm building ASP.NET MVC2 application, and using Entity Framework as ORM. I am having troubles updating object in the database. Every time I try entity.SaveChanges(), EF inserts new line in the table, regardless of do I want update, or insert to be done. I tried attaching (like in this next example) object to entity, but then I g...
Hi,
Does Entity Framework v4 support batch updates/inserts so rather than sending >1 command to a db, it can send >1 command to the DB in one go?
Thanks
...
Currently I've been working with Entity Framework 1.0 which is located under a service façade.
Below is one of the save methods I've created to either update or insert the device in question.
This currently works but, I can't help feel that its a bit of a hack having to set the referenced properties to null then re-attach them just t...
Hello
I have this code:
public IEnumerable<SomeClass> GetAvalibleThingies(DateTime startDate, DateTime endDate, int categoryID)
{
if (_entities.Connection.State == System.Data.ConnectionState.Closed)
_entities.Connection.Open();
using (EntityCommand c = new EntityCommand("SomeEntities.GetAvalibleThing...
At first I was using this as an extension method to update my detached entities...
Public Sub AttachUpdated(ByVal obj As ObjectContext, ByVal objectDetached As EntityObject)
If objectDetached.EntityState = EntityState.Detached Then
Dim original As Object = Nothing
If obj.TryGetObjectByKey(objectDetached.EntityKey, or...
Hi,
I have created my own entities in edmx i.e. temp table for a stored procedure.
Now when i update my EDMX and adds or update any table, the entity which i created (for temp table) is removed from SSDL portion.
Is there any way that my changes are not lost. Mean can extend EDMX or any other way.....
Thanks...
...
Hi, I am creating a project using Entity Frameworks 4 and self tracking entities. I want to be able to either get the data from a sql server 2008 database or from sql server compact database (with the switch being in the config file). I am using the repository pattern and I will have the self tracking entities sitting in a separate ass...
I'm learning EF now and have a question regarding the ObjectContext:
Should I create instance of ObjectContext for every query (function) when I access the database?
Or it's better to create it once (singleton) and reuse it?
Before EF I was using enterprise library data access block and created instance of dataacess for DataAccess fun...
Ok, this question has been asked many times. Just googling with the error message:
The specified named connection is either not found in the configuration,
not intended to be used with the EntityClient provider, or not valid.
I have tried all suggestions on forums, help sites et blogs... nothing works!
Stuation recap
I'm splitting ...
how can i do the code
static string BuildMenu(List<Menu> menu, int? parentId)
{
foreach (var item in menu.Where(i => i.ParentMenu == parentId || i.ParentMenu.MenuId == parentId).ToList())
{
}
}
return BuildMenu(menuList,null);
so if parentId==null then return only records i =>...
<Page>
<Page.Resources>
<data:Quote x:Key="Quote"/>
</Page.Resources>
<tk:DataGrid
DataContext="{Binding Quote}"
ItemsSource="{Binding Rooms}">
<tk:DataGrid/>
</Page>
Code:
Private Sub InitializingNewItem _
(sender As DataGrid, _
ByVal e As InitializingNewItemEventArgs) _
Handles...
Using aspnet mvc2 with the model auto-generated by entity framework:
Is it possible to tell entity framework to auto-annotate all fields? eg:
If database field says not null then add [Required]
If DB field is a nvarchar(x) then add [StringLength(x)]
And so on?
What if the field name contains the string "email" eg CustomerEmail - can...
Hi,
is there any option when updating classes in EF4 Modeller to disable the drop
of all data and tables, just to append non existing fields and leave old tables and data
untouched.
I mean not to change every time on every little change to edit manual the SQL files.
Thanks.
...
I'm been looking around and trying to see if the Entity Framework 4 will run under Visual Studio 2008, but can;t find any references to it.
Can you get EF4 working on VS2008?
...
i need to use the like operator in a linq query
for this:
timb = time.Timbratures.Include("Anagrafica_Dipendente")
.Where(p => p.Anagrafica_Dipendente.Cognome + " " + p.Anagrafica_Dipendente.Nome like "%ci%");
How can i do?
...
Is it possible to make some work in parallel with entity framework for following example?
using (var dbContext = new DB())
{
var res = (from c in dbContext.Customers
orderby c.Name
select new
{
c.Id,
c.Name,
c.Role
...
We are running several calls against a SQL Server database within a transaction scope using entity framework.
Are we right is assuming that the SPID will be held for the duration of the transaction and that all calls will be made on the same SPID?
...
Hi,
what is the default pattern using in entity framework?
is it the Simple Entities or Change Set?
Can you give me a simple code for each one?
thanks
...
Right... calling all Entity Framework experts...
I have a table called Bob in my database, my EF model contains an exact mapping/definition of this. I also have a table called Jim who is also mapped to my entity model. Bob can have multiple Jim's and this relationship is enforced by foreign key constraints as it should be. So the relati...