1
Vote

Null reference exception WCF, DAAB, WPF

description

Hello,
 
I’ve been building your intro project using different combinations…checking out the tool. WCF, LINQ, WPF works without issue but when I run with WCF, DAAB, WPF a “null reference exception” is thrown on a GetAll or Insert. Looks like an IQ call is trying to do a property get on a null <Entity> built from extensible object (no constructor called for <EntityType>). Curious on your thoughts…
 
Cheers,
Robin

comments

RobertMujica wrote May 25, 2009 at 12:23 PM

Hi there, I have similar problem more precisely "Object reference not set to an instance of an object", I created a new project using Microsoft SQL Server, MVC, DAAB and WCF with one single Entity with two fields (ID and Title), when running I got null reference exception raised from GetAllIQ() call from within the <Entity>RepositoryBase's GetAll() method.

It looks like when the application call the set{} accessor to any of the properties of this Entity e.g.

if (this._entityData.DinnerID != value) // here the _entityData field is null for some reason one of the constructors used to initialise this field don't get called so that we got this error.
{ ................}

Cheers
Robert

minnow78 wrote Jun 25, 2009 at 4:31 PM

See this post in Discussions - _entityData seems to be null on insert

WCF & DAAB are not compatible. I have NHibernate working successfully with WCF but am not satisfied with it as NHibernate is not stateless (I don't think). Correct me if I'm wrong - but even after making changes to web.config, NHibernate is still holding locks on the database.

wrote Feb 14, 2013 at 2:46 AM