-
Notifications
You must be signed in to change notification settings - Fork 3
Factory
FelicePollano edited this page Oct 19, 2011
·
5 revisions
We can obtain a FlyFetch collection by using the CollectionFactory class. Here the Create signature:
public static void Create<T,TColl>(
int pageSize,
IPageProvider<T,TColl> pageProvider,
ICountProvider countProvider,
Action<TColl> created
) where T:new() where TColl:IList<T>,new()
Uhmmm a void returning factory method, really strange, isn't ?
The reason is that FlyFetch is written with asynchronous operation in mind, so, since creating the collection can be a blocking operation, the factory returns immediately, and the Action created will execute when the collection is available.
You can call the factory by using:
CollectionFactory.Create<T,TColl>(...)
The type arguments are:
- T: The type representing the single collection item. This has to be proxy friendly in order to work with FlyFetch
- TColl: The type of the collection implementation you want to use. It has to implement IList and must be creatable.