Datasources

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

Last edited Apr 8, 2010 at 12:04 AM by robashton, version 2

Comments

No comments yet.