Search code examples
c#insight.database

Can Insight.Database stream data from an interface?


A simple yes or no, I suppose.

Let's say I'm using dependency injection to make use of Insight.Database's auto interfaces as a repository.

Let's also say that some of those tables are way too big to want in memory.

Given that I have injected "repositories", can I stream data from them? The documentation only details using extension methods on a SqlConnection object.

Cheers.


Solution

  • Well, some testing shows that yes it can, and far more easily than the implementation that's documented.

    Simply declare the sproc return as IEnumerable rather than IList and the enumerable is not enumerated until required and has performance approaching that of a forward-only recordset.

    With this and the implementation of BulkCopy, my performance worries are wholly set to rest.