ConnectionManager for DAL in WinRT project??

ConnectionManager for DAL in WinRT project??

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


TSF posted on Friday, October 05, 2012

I'm trying to figure out how to create a DAL for SQLite.

I started by creating new DataAccess and DataAccess.SQLite projects, following the pattern I use for my normal SL projects.  But when referencing the WinRT CSLA assembly, I don't have access to the ConnectionManager class.  I'm guessing that is because there is no System.Data available for WinRT.

Should I expect to be able to use the ConnectionManager class in my SQLite DAL, such as the following?  Or does this concept not apply for what I'm doing?  Thanks.

using (var ctx = ConnectionManager<SqlConnection>.GetManager("SQLiteDbName"))

TSF replied on Friday, October 05, 2012

Maybe I need to just read more in the DataPortal e-book about using a custom proxy.  Although I'm still not sure about whether I need to handle a "connection" to a SQLite database in a special way...entirely new to that.

RockfordLhotka replied on Friday, October 05, 2012

Because there's no System.Data in WinRT, most (all?) of the Csla.Data functionality isn't there either.

TSF replied on Saturday, October 06, 2012

Related to this, I'm trying to understand how to use a custom proxy following the code in your ProxyFactorySl example.  In both my project and your example project, the compiler is having trouble with the following two highlighted lines:

    protected override Csla.DataPortalClient.IDataPortalProxy<T> GetProxy<T>(Csla.DataPortal.ProxyModes proxyMode)
    {
      var offline = (bool)Csla.ApplicationContext.LocalContext["Offline"];
      if (proxyMode == DataPortal.ProxyModes.LocalOnly || offline)
        return new LocalProxy<T>();
      else
        return new WcfProxy<T>();
    }

 The error is "The type 'T' cannot be used as type parameter 'T' in the generic type or method 'Csla.DataPortalClient.LocalProxy<T>'. There is no boxing conversion or type parameter conversion from 'T' to 'Csla.Serialization.Mobile.IMobileObject'."

 Could you provide direction in what to do to resolve this?  Thanks.

Copyright (c) Marimer LLC