Need a simple Silverlight ReadOnlyList example

Need a simple Silverlight ReadOnlyList example

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


KevinKlasman posted on Thursday, March 18, 2010

I'm new to Csla (but have used it to some degree in the VB6 days) and Sliverlight. I have the Expert C# 2008 Business Objects book, which I've read Chapters 1-5, 15, 17 and parts of the other chapters as seemed appropriate.

I'm using VS2010 Beta 2, SL4 beta, CSLA 3.8.2

I'm trying to write a simple SL4 app that binds a ReadOnlyListBase derives class to a datagrid. I want to use the simple WcfPortal.

I've looked at the Rolodex sample (which runs) and functionally does what I want (ReadOnlyCompanyList, but it uses SynchronizedWcfProxy which I don't want to use (mainly because I don't know why I would want to).

Chapter 5's Read-Only Collection section shows a factory method that calls DataPortal.Fetch<ReadOnlyList>... but when I try to code that only DataPortal.FetchChild is supported.

Chapter 5's code:

        public static ReadOnlyList GetReadOnlyList(string filter)
        {
            return DataPortal.Fetch<ReadOnlyList>(new SingleCriteria<ReadOnlyList, string>(filter));
        }

What seems like the corresponding method in the Rolodex sample is:

    public static void GetCompanyList(EventHandler<DataPortalResult<ReadOnlyCompanyList>> handler)
    {
      DataPortal<ReadOnlyCompanyList> dp = new DataPortal<ReadOnlyCompanyList>();
      dp.FetchCompleted += handler;
      dp.BeginFetch();
    }

I've tried that but I wonder whether the rest of my app supports that approach the calling Fetch.

I imagine the Rolodex sample uses a different GetXXXList signature because its SL and that the book's example won't work with SL. Am I right?

So, as you can tell, I'm throughly confused.

So, does anyone have a sample SL4 app that does this that they'd care to share with me? I would greatly appreciate it.

Another thing...I don't like the conditional compilation in the current SL examples, so I've tried splitting the business classes up into partial classes, with the SL stuff in one (in Library.Client assembly) and the non-SL stuff in another (In Library.Server assembly). The Rolodex examples has GetCompanyList(...) compiled into both, which surprises me. I think it only belongs in the SL side, but am I mistaken?

Finally, would I be better off switching to VS2010 RC, SL4 RC, CSLA 4.x?

Thanks,

cds replied on Thursday, March 18, 2010

Hi Kevin

Yes, all of Silverlight requires asynchronous calls. So, you have to take the book as a guide only, which is a bit difficult for somebody starting out.

I don't have a sample to share, unfortunately. I don have a gigantic CSLALight, SL3 app though :)

Craig

Copyright (c) Marimer LLC