entity

Why does my Lambda query return an anonymous type versus Linq's strongly-typed return value?

Ok, bear with me... hadn't done any Linq or Lambda until a couple of days ago :) I'm using C# and the ADO.NET Entity Framework. I want to query my model and get back a List of objects based on a relationship. Here's my code: var query = db.Achievements.Join ( db.AchievementOrganisations, ach => ach.AchievementId, ao => ao.Achieve...

Composition issues in entity framework 4: The entity is currently read-only

Using WCF RIA Services and entity framework 4. I have 3 DTOs: School, State, District. The state DTO has a District property with composition. And the School DTO has a State property with composition and a District association. The idea, is that when we create/update a school, we also allow the user to enter the state and district (w...

use sqlalchemy entity isolately

i just want to use an entity modify it to show something,but don't want to change to the db, but after i use it ,and in some other place do the session.commit() it will add this entity to db,i don't want this happen, any one could help me? ...

Collection.ToList<TResult>() extension method raises compile time error

I cannot use ToList<Tresult>() extension method. The code I use is, return this.Semesters.ToList<ISemester>() 'Semesters' in above code is an EntityCollection. These using directives are already present, using System; using System.Collections.Generic; using System.Linq; using System.Text; Still I cannot Compile as it keeps on com...

Windows applicaton: CRUD operations using linq to entities on datagrid

How do i wrap the linq to entities using c# to a datagrid . I was working earlier on web, so windows is new to me. I have like first name, lastname, phone numbers from a person object i want to display list of persons in datagrid but phone numbers needs to be combo box. Phone numbers are from different table. I get a list of anonymo...

NHibernate Entity access through projection

I have this mapping file: 'class name="WebTools.Data.Common.IHObjekt, WebTools.Data" table="IHObjekt"' .... 'property name="TYPBEZEICH" type="string"' ... 'many-to-one name="standort" column="STANDORT_ID" fetch="join"' And I would like to use a 'Projections.ProjectionList()' to reduce the number of returned columns from the...

Modeling a badly designed database using Entity Framework

Hi, I am trying to model a database that is badly designed. The POCO objects I came up using Entity Framework(EF) do not represent the business entities accurately as I am limited by bad DB design . I am planning on having my business entities defined separately and have them map to POCO. So it would be something like: Business Entiti...

StringEscapeUtils.unescapeHtml() problem in unescaping HTML entities for Android

This is what I'm doing: public static String htmlToText(String inString) { String noentity=StringEscapeUtils.unescapeHtml(inString); return noentity; } This is where I'm invoking it: String html = "<html><body>string 1<br />&#8212;<p>string 2</p></body></html>"; String nohtml = Utility.htmlToText(html); Log.i("NON HTML STRING...

Poco class inherit entityobject

I have a t4 template wich generates my poco classes. Everything is working fine. Now, i want to inherit those classes from EntityObject (i want to know about EntityState sometimes) but when i do this, the relationships are always returning null (lazy loading not working). Any suggestions ? Here is a simple model public partial cla...

insertNewObjectForEntityForName returns wrong type

Hello everyone, I've been pulling my hair for the last few hours trying to figure out why insertNewObjectForEntityForName is returning NSManagedObject even though I'm trying to insert an entity of my own type. Things I have checked a thousand times: Class name is set to the correct value in the diagram designer Entity has many-to-man...

Entity Framework 4 - prevent basic caching

If I have an entity framework 4 context, normally if I have run a query like: db.Invoices.Where(I => whatever); and then later run something else: db.Invoices.Where(I => something_else); any objects returned from the second query, which were also returned from the first, will not be loaded from the database. EF will just take the ...

Return Type for Collection from LINQ Query

I have a method, that returns a group of accounts Public Shared Function GetAllNotesByUser(ByVal UserID As Guid) As Account (??) Using db As New MyEntity Dim query= (From A In db.Account _ Where A.aspnet_Users.UserId = UserID _ Select A) Return query End Using End Function ...

iPhone - Core Data Question ??

I have 2 entities : User, Address. I have set the relationship each User can have many "Address". I am not sure how core data works but from my understanding, every time i call insertEntityForName it creates and stores an object. (also a row in table) So the question: Doesn't the following code store a duplicate address in core data? ...

Dynamic Fetch an Inheritance in Entity Framework 4 POCO

Hey guys, Is there anyway to make a dynamic fetch in entity framework 4 If you have some inheritcance where a and b inherit from c Can you call one linq query to get a list of a, and b using the data set for c? ...

asp.net mvc input / model validation multi language

I'm quite new to asp.net mvc, and right know I'm trying to find out a good practise to do input validation. In the project we're going to use entity framework, where you can add data annotations to properties in the following way: [Required(ErrorMessage = "Please enter a product name")] [Column] public string Name { get; set; } This...

Why am I getting JPA LazyInitializationException when using Spring OpenEntityManagerInViewFilter?

My application of OEIV Filter doesn't seem to be getting applied to my Struts actions. I am using Spring 3, Spring Security 3, Struts2, Tiles2 and JPA backed by Hibernate 3. When I try to access a collection for an entity in a struts action, unless the Entity has a fetch type of eager, I am getting a JPA LazyInitializationException. I s...

How to use entitycollection for binding to wpf UI

I'm using EntityFramework for data access and wpf as UI. If I bind WPF components to navigation properties of my entity classes(usually EntityCollection<EntityClass>, exposed as IList<T> in service layer), UI is not updating the changes. I know i have to use ObservableCollection<T> or such, but I need some guidance on how to use it witho...

Detaching Entities in EF4 - losing object graph

As other questions have noted, when you detach and re-attach an object, any child objects are gone. I thought doing this: db.Properties.MergeOption = System.Data.Objects.MergeOption.OverwriteChanges; would cause subsequent reads to fully repopulate the object and graph when it was read in, but no such luck. Is there any way to get t...

how to change the html tags into html entities using PHP

This is a simple question. I am using the libmail class to send my mails. For composing the mails I am using the CKEditor. My problem is that when I send the mail to someone the mail is displaying like this: <p><span style="color: rgb(255, 160, 122);">data</span></p> I already tried this: $message = htmlspecialchars(stripslashes($mes...

Update database from model - Entity Framework

Is it possible in any way to just update the database schema from entity model..? So that all the information in the database stays in the database? When you generate database from model the information will get lost.. I work against SQL Azure, and I have not found any tool to manage the tables and realations in the SQL Azure database in...