About Data Portal

About Data Portal

Old forum URL: forums.lhotka.net/forums/t/11007.aspx


st3fanus posted on Thursday, December 22, 2011

Hi all..

I think i have read thi on ebooks but i forgot where is it location.

So I want to ask for confirmation about :  ( I use encapsulation invocation )

Is it right that DataPortal.Fetch and DataPortal.BeginFetch and other crud client side data portal will call the same

DataPortal_XYZ methods ??

1. What I'm not sure here is : who is responsible to trigger invocation of callback method when asynchronous calling is used ??

2. Is it automatically called by dataportal client side or server side ?? If yes, so how about silverlight implementation DataPortal_XYZ where i saw on ebook that it trigger callback..? Is it intended for silverlight as edge application where Local Mode is used so we must implement DataAccessInvocation on silverlight ( client side ) ?

 

if you know, the location on ebooks that explicitly tell about it is help me alot ?

note :  I still in the middle of learn about CSLA.NET 4 use ebook

 

 

thanks a lot

stefanus

RockfordLhotka replied on Friday, December 23, 2011

In a Silverlight app in local mode your DataPortal_XYZ method is responsible for making a callback to tell the data portal your data operation is complete.

The DataPortal_XYZ method gets a callback parameter that must be invoked when your method is complete - including the case where an exception occurs. This callback must always be invoked when the operation is complete, success or failure.

Look on page 6 of the Data Access ebook for an example.

st3fanus replied on Friday, December 23, 2011

Hi Rocky,

thanks for your quick response.

 

If you don't mind could you give me your confirmation about :

If a silverlight app is not in local mode, for example : If i use asynchronous below :

public static void GetPersonEdit(int id, EventHandler<DataPortalResult<PersonEdit>> callback)

{

DataPortal.BeginFetch<PersonEdit>(id, callback);

}

Is the above client side data portal will eventually call

private void DataPortal_Fetch(int id) { ........ }   ???

and what I want to know for confirmation is : who is responsible to trigger callback when DataPortal_Fetch(int id) above is done ??

I feel i have read about this explanation on ebook but I forgot the location :(

 

thanks a lot

stefanus

RockfordLhotka replied on Saturday, December 24, 2011

The DataPortal_Fetch() will have TWO parameters, not just one. It accepts a callback handler parameter. See page 6 of the Data Access ebook for an example.

st3fanus replied on Sunday, December 25, 2011

Hi Rocky,

I'm sorry for my repeated question, this because I follow  on ebook 5 ( UI ).

And I got a confuse, I'm hard to get a robust understanding about Factory Method associate with Data Invocation methods.

 

[ My current understanding ]

# Assumption : 3 tiers and not in local mode.

# My Confuse : If I write two type of factory methods ( ie :  for .NET client and for SL client )  then Am I must define two type Data Access methods too ? ( DataPortal_XYZ )

for example :

1. Asychronous Call.

public static void GetPersonEdit(int id, EventHandler<DataPortalResult<PersonEdit>> callback)

{ DataPortal.BeginFetch<PersonEdit>(id, callback); }

and

2. Sychronous Call.

public static PersonEdit GetPersonEdit(int id)

{ return DataPortal.Fetch<PersonEdit>(id); }

 

# Based on my understanding now :

Client side data portal will call server side data portal on server machine (Am I right ? ) , BUT which one is called ?

=> Is no 1 and no 2 will call different DataPortal_XYZ ?

     (  My mind here is : )

   Angel  no1 will call =>

public void DataPortal_Fetch( int id, Csla.DataPortalClient.LocalProxy<PersonEdit>.CompletedHandler handler)

{   ..........    } ???

OR this is just for a local mode call, and run on client (SL) OR no 1 call will eventually call

private void DataPortal_Fetch(int id)

{ .......    }

because silverlight client will call server side data portal on server ( an associated Business object created by DataPortal ) So

DataPortal will run DataPortal_Fetch(int id ) only on server side ?? BUT if this is what happened , I have a question on who is responsible to trigger a complete asychronous call ?? so client side can call a callback method.

 

Beer   AND no 2 will call =>

private void DataPortal_Fetch(int id)

{ .......    } ???

 

SO , If the answer for A and B is YES, I must define both of DataPortal_XYZ above, right ?

 

I'm sorry before for my repeated questions Rocky, because I can't get an example on ebook for my questions EXPLICITLY.

So I hope i can get a solid understanding for this problem :)

I have read your book more than once with different focus on area, because I feel I have ever read on this topic, but i look for it again, I can't found it :(

 

 

thanks a lot rocky

 

stefanus

Copyright (c) Marimer LLC