Confusion about DataPortal Client and Server Side and Conclusion !

Confusion about DataPortal Client and Server Side and Conclusion !

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


st3fanus posted on Wednesday, December 28, 2011

Hi all,

I'm sorry before if this is too long, BUT I hope anyone could give me an answer or confirmation or anything about this problem !!

 

I arrived at a confusion about client side data portal with associated server side data portal.

Below is the scenario which is I need a confirmation. Am I right or wrong and which is the truth ?

the scenario I'm talking about here is not in local mode. ( said it is in 3 tiers ), and used Encapsulated Invocation Model.

 

# MY CURRENT UNDERSTANDING.

No 1. [ Use Synchronous calling ]

public static RootExample GetRootExample(int id)

{

DataPortal.Fetch<RootExample>(id);

}

this client side data portal will initialize invocation into server side, and the server side data portal will create a RootExample BO, and then invoke data access method in RootExample object, like :

private void DataPortal_Fetch(int id)

{  // content here..  }         to setup initial properties. and then return into the calling code.

Am I right ? (  for no 1)

 

No 2. [ If the calling  code use Asynchronous calling ]

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

{

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

}

for example this asynchronous calling, I intended used for WPF or SL.

SO , based on my knowledge i got from ebook, this asyn calling will trigger a notification when operation complete into calling code. and MY QUESTION here is :

Is the same data access method ( like no1 ) will be called on the server when this asyn is started ? So I can used the same data access for Syn and Asyn calling.

private void DataPortal_Fetch(int id)

{  // content here..  }

     And , If the answer is Yes, so who is responsible for trigger notification when operation completed to calling code ??

     And, If NO, so what data access method will be called on server side ?

 

No 3. [ Data Access on Silverlight ]

I read on ebook about this data access for silverlight implementation.

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public void DataPortal_Fetch( int id, Csla.DataPortalClient.LocalProxy<RootExample >.CompletedHandler handler)

{

try

{

// invoke external DAL here (encapsulated invoke)

// or implement DAL code here (encapsulated implementation)

handler(this, null);

}

catch (Exception ex) { handler(null, ex); }

}

My QUESTION is :

a. Is the data access above is called ONLY when a silverlight data portal client in local mode is called ?? like this:


public static void GetRootExample (int id, EventHandler<DataPortalResult<RootExample >> callback)

{

DataPortal.BeginFetch<RootExample >(id, callback, DataPortal.ProxyModes.LocalOnly);

}

So, the scenario for example is : SOA where SL as an edge application

b. My question here is actually relate to no 2 ( IF the answes is NO ).

Is the data access above will be called with no 2 factory method ( Asyn calling )

my quess is NO, BUT I still want a confirmation or anything sharing knowledge from expert.

So I can think in the right way.

 

Note :

You can answers in format for help me quickly indentified

no 1 => ......

no 2=> .....

no 3a => .......

no 3b => .....

 

Thanks a lot every one

stefanus

 

 

 

JonnyBee replied on Wednesday, December 28, 2011

Hi,

no 1 =>  Correct

no 2=>  The same data access code is called and DataPortal will invoke the callback when response is received.

no 3a => Correct, this is primarily for edge applications that use asynchronous data access in SL.
                 This requires the callback to follow all the way down to data access code.

no 3b =>

 

 

st3fanus replied on Wednesday, December 28, 2011

Hi jonny..

thanks a lot for your quick response.

I think I'll get an answer tomorrow, because the different time about 12 hours, BUT .. wow.. nice :)

I love this community

 

thank you because you give me a confirmation of my quess, I'll continue in the progress to learn CSLA again..

And I think if you don't mind I will come back into this thread again. because I have found examples on Rocky ebook ( which is still in progress ) that could make me confuse at first because I'm in the middle of learning CSLA Foundation. ( So I hope Rocky can quickly finish these ebooks series :) ) thanks Rocky..

 

Note :
Could you told me , where is the location about no 2 questions on ebooks. on what page ? Because ebooks is my primary source for learning CSLA and of course this community :)

 

thanks a lot

stefanus

 

 

JonnyBee replied on Wednesday, December 28, 2011

Hi,

UsingCsla4-03-DataAccess - page 5 and onwards show how to use the dataportal.

RockfordLhotka replied on Thursday, December 29, 2011

Regarding the ebooks being "not complete" - books 1-6 are complete, some of them are just going through copy editing to clean up language, punctuation, and that sort of thing. The content won't change in any meaningful way other than to address errata.

Book 7 is taking longer than I'd expected, mostly because I don't want to demonstrate a poor WP7 app implementation, and I keep rethinking aspects of WP7 app development... I am now thinking I'll have this done in January.

Copyright (c) Marimer LLC