1. Add a reference to CoconutDal.dll

2. Configure database in web/app.config:

Here is a simple configuration where you have one database for development and one for your live application. Coconut Dal can also support using multiple databases, see configuration options. Or, if you prefer to manage your own connection strings, simply create your Coconut Dal with the constructor that accepts a connection string (also covered in configuration options.)

    <section name="CoconutDalConfigurationSection"
        type="CoconutDal.Configuration.CoconutDalConfigurationSection, CoconutDal"/>  
<Database UseName="Test">
            <add Name="Test" ConnectionString="Data Source=MyLocalDBServer;
Initial Catalog=CoconutMilk;Integrated Security=True;
"/> <add Name="Live" ConnectionString="Data Source=MyLiveDBServer;
Initial Catalog=CoconutMilk;Integrated Security=True;
"/> </Connections> </Database> </CoconutDalConfigurationSection>
3. Use the Dal:
ICoconutDal dal = new SqlServerCoconutDal();
object result = dal.GetSingleValue("MyStoredProcedure");

Coconut Dal has a full suite of data access methods for Sql Server. You can execute non-queries or retrieve a value, a row, a column or a table.

Examples of how to use Coconut Dal can be found on the Use Cases page

If you need more, you can also extend the SqlServer implementation or create your own implementation of the ICoconutDal interface. See Advanced Use for more information.

Click here to see all the available documentation on this site.

Last edited May 31, 2012 at 11:18 PM by CoconutDev, version 4


abhijit74 Sep 28, 2013 at 6:09 PM 
What is the minimum SQL Server version where CoconutDal can be used?