Destination

BLToolkit.NET

Business Logic Toolkit for .NET www.bltoolkit.net
 

Return value of an abstract method defines a result that this method returns. The Destination attribute allows specifying one of the method parameters as the result.

Destination.cs
using System;
using System.Collections.Generic;

using NUnit.Framework;

using BLToolkit.DataAccess;

namespace HowTo.DataAccess
{
    [TestFixture]
    public class Destination
    {
        public abstract class PersonAccessor : DataAccessor
        {
            public abstract void SelectAll([Destination] IList<Person> list);
        }

        [Test]
        public void Test()
        {
            PersonAccessor pa = DataAccessor.CreateInstance<PersonAccessor>();

            List<Person> list = new List<Person>();

            pa.SelectAll(list);

            Assert.AreNotEqual(0, list.Count);
        }
    }
}
App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add
            key   = "ConnectionString"
            value = "Server=.;Database=BLToolkitData;Integrated Security=SSPI"/>
    </appSettings>
</configuration>
Create.sql script
 
© 2010 www.bltoolkit.net
[email protected]