New Posts New Posts RSS Feed: public static IEntityQuery -> entityserverfault
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

public static IEntityQuery -> entityserverfault

 Post Reply Post Reply
Author
enterprisetoday View Drop Down
Newbie
Newbie


Joined: 03-Mar-2009
Posts: 12
Post Options Post Options   Quote enterprisetoday Quote  Post ReplyReply Direct Link To This Post Topic: public static IEntityQuery -> entityserverfault
    Posted: 14-May-2010 at 9:32pm
Hi,
We came accross this issue that stumped us. It was not until we begun UAT with this release that we discovered this issue. The codebase worked fine in visual studio, however our UAT configuration uses an n tier model. (clients connect to serverconsole over a lan).

278             /// <summary>
279             /// Returns a query which the user can build upon with.
280             /// Returns all ledger entries between the date range.
281             /// </summary>
282             public static IEntityQuery<Ledger> reportBankingList = Mgr.Ledgers
283                                     .Where(l => l.DATE >= Report_startDate && l.DATE <= Report_endDate);

where Report_startDate and endDate are both public static datetimes.

286             /// <summary>
287             /// reportXXXtotal, for use in BankingList report.
288             /// Returns the decimal value of the items requested for the date range set earlier.
289             /// </summary>
290             public decimal reportChequeTotal
291             {
292                 get
293                 {
294                    var query = reportBankingList
295                       .Where(l => l.TYPE == 2 && l.PAY_METHOD == 1);
296     
297                    return query.Sum(l => l.AMOUNT * -1);
298                 }
299             }

source="IdeaBlade.EntityModel.RemoteEntityServerProxy:ConfigureChannelFactory">Using NDC Serializer</entry>
source="IdeaBlade.EntityModel.RemoteEntityServerProxy:ProgrammaticConfiguration">Created proxy to http://w4:9009/EntityServer_Production6 using ideablade.configuration section; binding is 'CustomBinding', contract is 'IdeaBlade.EntityModel.IEntityServerContract'</entry>
source="IdeaBlade.EntityModel.EntityServerProxy:Fetch">System.ServiceModel.FaultException`1[IdeaBlade.EntityModel.EntityServerFault]: Type conflict: the DefaultManager is currently of type EntityManager (Fault Detail is equal to IdeaBlade.EntityModel.EntityServerFault).</entry>
source="IdeaBlade.EntityModel.EntityServerProxy:Fetch">System.ServiceModel.FaultException`1[IdeaBlade.EntityModel.EntityServerFault]: DomainModel.User must inherit from Entity and does not. (Fault Detail is equal to IdeaBlade.EntityModel.EntityServerFault).</entry>

This is the clients debuglog.xml file. We received the errormessage description in dialog boxes on the client.

We initially suspected build problems but eventually traced it down to the query. btw, no issues if it's not static. We could return a list of entities (which is our normal MO), however in this situation we wanted to further filter the results as the user has the option to pick and choose ledger entry types.
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 17-May-2010 at 7:00pm

Just to confirm, you're saying the code works in n-tier if reportBankingList is not static?

It looks like this code is called on the server.  Can you show how Mgr is defined and the context in which this query is called?
 
Thanks.
 
Back to Top
enterprisetoday View Drop Down
Newbie
Newbie


Joined: 03-Mar-2009
Posts: 12
Post Options Post Options   Quote enterprisetoday Quote  Post ReplyReply Direct Link To This Post Posted: 18-May-2010 at 5:31pm
Hi ting,

We discovered that while the code worked when non-static, more testing caused it to fail in another (unrelated) area of the system. so we removed that code altogether.  My guess is that if a Ledger entry is instantiated, then the query will fail (spectacularly) in some instances and pass this upwards. A try/catch here would prevent any disaster from taking out the whole application.

For this project, Mgr is defined as

public static DomainModelEntityManager Mgr

which sits in a common class in the domain model.
The query was called from a report:

var query = Ledger.reportBankingList
                       .Where l => l.TYPE == 2 && l.PAY_METHOD ==1);


And the public decimal was called as:

labelFootCheque.DataBindings.Add("Text", DataSource, Ledger.PathFor(l => l.reportChequeTotal), "{0:c}");


Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 28-May-2010 at 4:12pm
I just found out that we saw case earlier this year where static initializers were failing under IIS.  Make sure that you are deploying all the assemblies into the bin folder and that DevForce is not installed in the GAC.


Edited by ting - 28-May-2010 at 4:14pm
Back to Top
enterprisetoday View Drop Down
Newbie
Newbie


Joined: 03-Mar-2009
Posts: 12
Post Options Post Options   Quote enterprisetoday Quote  Post ReplyReply Direct Link To This Post Posted: 31-May-2010 at 5:10pm
Thanks for the update ting,
I tested it again.

Note:
1. This is not under IIS,
2. Installed on a test ws2008 w/ sql server 2008.
3. I Don't think it's in the GAC then.

I redid my build projects just in case it was missing some files.  It does make some sense that if this code works within visual studio, but one when it's installed as an application, then one can assume it's missing something.

They're too large here, would you like the debuglog.xml files?
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 08-Jun-2010 at 6:46pm
Yes, can you open a support case and send the debuglog files?  (Also, reference this thread.)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down