Skip to content

DataAccess.Destination

Igor Tkachev edited this page May 22, 2016 · 1 revision

Home / DataAccess

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>
    <connectionStrings>
        <add
            name             = "DemoConnection"
            connectionString = "Server=.;Database=BLToolkitData;Integrated Security=SSPI"
            providerName     = "System.Data.SqlClient" />
    </connectionStrings>
</configuration>

CreateSql

Clone this wiki locally