Changes to Each BL Class Designer File. Since Silverlight Factory methods must be ASynch, the following modifications. #region "Factory Methods" #if !SILVERLIGHT All the existing factory methods with no modifications #else public static void NewRecord(EventHandler<DataPortalResult<BLProject>> handler) public static void GetRecord(System.Int32 ProjectId, EventHandler<DataPortalResult<BLProject>> handler) public static void DeleteRecord(System.Int32 ProjectId, EventHandler<DataPortalResult<BLProject>> handler) EXCLUDED from Silverlight are Save() since we will use the Asynch BusinessBase.BeginSave(EventHandler<SavedEventArgs> handler) method. EXCLUDED from Silverlight are the GetRecord(DTProject DTOProject) method since it will only run on the server in connection with DataAccess. #endif Examples of these Asynch Factory methods: public static void NewRecord(EventHandler<DataPortalResult<BLProject>> handler) { if (!CanAddObject()) { throw new System.Security.SecurityException("User not authorized to add data"); } DataPortal<BLProject> dp = new DataPortal<BLProject>(); dp.CreateCompleted += handler; dp.BeginCreate(); } public static void GetRecord(System.Int32 ProjectId, EventHandler<DataPortalResult<BLProject>> handler) { if (!CanGetObject()) { throw new System.Security.SecurityException("User not authorized to view a data"); } DataPortal<BLProject> dp = new DataPortal<BLProject>(); dp.FetchCompleted += handler; dp.BeginFetch(new SingleCriteria<BLProject, System.Int32>(ProjectId)); } public static void DeleteRecord(System.Int32 ProjectId, EventHandler<DataPortalResult<BLProject>> handler) { if (!CanDeleteObject()) { throw new System.Security.SecurityException("User not authorized to delete data"); } DataPortal<BLProject> dp = new DataPortal<BLProject>(); dp.DeleteCompleted += handler; dp.BeginDelete(new SingleCriteria<BLProject, System.Int32>(ProjectId)); } End of Part 2 - More coming soon. Paul Solheim www.faktnet.com |