I am running into a problem when I run my application with a WCF Portal.
I have a BO with Child and GrandChild BO's. I first ran into the problem with the GrandChild Objects, but double checked with just a Child Object.
Things work fine with a Local DataPortal, but when I try to use a WCF Portal, the lazy loaded Objects can't load. I am getting a NullReferenceException on the connection string. I have a Database class like the sample code that return ConfigurationManager.ConnectionStrings and it seems like it isn't reading the correct web.config file or something.
The WCF portal works fine for the Parent Object and Child Objects loaded in the Parent's Fetch, but the lazy loaded Objects fail.
Here's the Parent Object Child Property code:
Private static PropertyInfo<Images> ImagesProperty = RegisterProperty<Images>(p => p.Images);
public Images Images
Here's the Child Object code:
Internal static Images GetImages(Project project)
private void Child_Fetch(int projectId) It's failing on the Database.ProjectGalleryConnection. Any help is appreciated. Eric
using (SqlConnection cn = new SqlConnection(Database.ProjectGalleryConnection))
using (SqlCommand cm = cn.CreateCommand())
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "Projects.GetImages";
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
private void Child_Fetch(int projectId)
It's failing on the Database.ProjectGalleryConnection.
Any help is appreciated.
I think the problem that you are having is because you are using DataPortal.FetchChild in the factory method for lazy loading.
The child dataportal methods work differently to what you would assume, and it was a mistake that I made as well.
Rocky explains it best in the this recent post: http://forums.lhotka.net/forums/t/8518.aspx
Thanks. I'll look into creating a Command object.
Copyright (c) Marimer LLC