Skip to content

Data Sources

reddy6ue edited this page Sep 4, 2017 · 3 revisions

A Datasource is an object that implements IDatasource, a simple implementation looks like this:

public class DummyDataSource : IDatasource
{
    Object Next(IGenerationSession session)
    {
        return 0;
    }
}

This will always return 0 and this is very similar to how the default conventions will set up any primitive properties found on generated objects.

For convenience, a generic version of IDatasource exists along with a base class

public class DummyDataSource : DatasourceBase<int>
{
    int Next(IGenerationSession session)
    {
        return 0;
    }
}

A complete list of AutoPoco provided datasources can be found here, but as you can see it is trivial to add your own to the system

Clone this wiki locally