-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
39 lines (29 loc) · 1.33 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Dormouse is based on a series of internal frameworks and toolkits I use for my own projects based on NHibernate.
Dormouse.Core includes basic tools for setting up a repository and performing a lot of basic database operations, including:
- Session Factory setup
- Session management
- Repository base classes (empty, CRUD, and CRUD+Search)
- Basic CRUD and search operations already stubbed out using generics
- Unit tests (using SQLite in-memory database)
Hello world example (Assuming you have downloaded and built from source):
1. Add a reference to Dormouse.Core.Dll
2. Set up your NHibernate app.config, mapping files, and POCO classes (see the unit tests for an example)
3. Create a basic CRUD repository (starting with an interface since we need this for testing. You do test, right?)
public interface IBookRepository : IRepositoryCRUD<MyPOCOType>
{
//Add any extra methods you want for your repository - Add/Edit/Get/Delete are already included!
}
4. Create your concrete reposotory
public class BookRepository : RepositoryCRUD<Book, int>, IBookRepository
{
//Implement any extra methods you added above
}
5. New it up and use it!
public void example()
{
var repo = new BookRepository();
var b = new Book { Title = "The Silmarillion" };
repo.Create(b);
b = _repo.Get(32768);
repo.Delete(b);
}