Skip to content

Commit 1cf1ca8

Browse files
author
Ajeet
committed
modified readme
1 parent 0f14264 commit 1cf1ca8

File tree

1 file changed

+40
-39
lines changed

1 file changed

+40
-39
lines changed

README.md

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ In order to perform database CRUD operation from .net application,
1313
the wrapper makes it quite easy by following the below steps.
1414
```
1515

16-
#### Application list and details
17-
18-
| App Name| Type | Comments|
19-
| --- | --- | --- |
20-
| Generic.Repository.EntityFramework| Class Library | EntityFramework wrapping business logic|
21-
| Generic.Repository.EntityFramework.Test| Test App |unit tests |
22-
| Generic.Repository.EntityFramework.ConsoleApp.Test | Console |Test the wrapping business logic |
23-
24-
> nuget package **"Generic.Repository.EntityFramework"** is a wrapper around ORM EntityFramework
25-
26-
<hr />
2716

2817
#### Steps to use the [![NuGet](https://img.shields.io/nuget/v/Generic.Repository.EntityFramework.svg)](https://www.nuget.org/packages/Generic.Repository.EntityFramework) package
2918

@@ -38,54 +27,66 @@ IDbContext type is inherited from the installed [![NuGet](https://img.shields.
3827
using Generic.Repository.EntityFramework; //add this reference
3928
//DB is real data model created from database
4029
public partial class DB : DbContext, IDbContext
41-
{
42-
public DB() : base("name=connectionstring"){}
43-
IDbSet<T> IDbContext.Set<T>()
44-
{
45-
return base.Set<T>();
46-
}
47-
public DbSet<Customer> Customers {get;set;}
48-
public int Save()
49-
{
50-
return base.SaveChanges();
51-
}
52-
....
53-
}
30+
{
31+
public DB() : base("name=connectionstring"){}
32+
IDbSet<T> IDbContext.Set<T>()
33+
{
34+
return base.Set<T>();
35+
}
36+
public DbSet<Customer> Customers {get;set;}
37+
public int Save()
38+
{
39+
return base.SaveChanges();
40+
}
41+
....
42+
}
5443
```
5544
> 3. Now all set, please add the below lines from your consuming object/component
5645
5746
```
58-
using Generic.Repository.EntityFramework;using Unity; //add these 2 references
47+
//add these 2 references
48+
using Generic.Repository.EntityFramework;
49+
using Unity;
50+
5951
public class ConsumeService
6052
{
6153
...
6254
void ConsumeMethod()
63-
{
64-
//get the Unity container
65-
var container = UnityConfig.Container;
66-
67-
// register your 'DataModel'
68-
container.RegisterType<IDbContext, DB>();
55+
{
56+
var container = UnityConfig.Container; //get the Unity container
57+
58+
container.RegisterType<IDbContext, DB>(); // register your 'DataModel'
6959
7060
var dbManager=container.Resolve<IDBManager>(); //get the db manager
7161
72-
//All wired up !!!
73-
DO YOUR CRUD OPERATION & Customer is the table name in DB;
62+
//All wired up. DO YOUR CRUD OPERATION & Customer is the table name in DB
7463
75-
//GET
76-
var result=dbManager.GetRepository<Customer>().Get();
64+
var result=dbManager.GetRepository<Customer>().Get(); //GET All
7765
7866
//FIND by id, where id is the primary key
7967
var result=dbManager.GetRepository<Customer>().Find(id);
8068
81-
// ADD, custObj is the Customer object
82-
var result=dbManager.GetRepository<Customer>().Add(custObj);
69+
// custObj is the Customer object
70+
var result=dbManager.GetRepository<Customer>().Add(custObj); //ADD
8371
84-
// DELETE, custObj is the Customer object
85-
var result=dbManager.GetRepository<Customer>().Delete(custObj);
72+
var result=dbManager.GetRepository<Customer>().Update(custObj); // UPDATE
73+
74+
var result=dbManager.GetRepository<Customer>().Delete(custObj); // DELETE
8675
}
8776
```
8877

78+
#### Application list and details
79+
80+
| App Name| Type | Comments|
81+
| --- | --- | --- |
82+
| Generic.Repository.EntityFramework*| Class Library | EntityFramework wrapping business logic|
83+
| Generic.Repository.EntityFramework.Test| Test App |unit tests |
84+
| Generic.Repository.EntityFramework.ConsoleApp.Test | Console |Test the wrapping business logic |
85+
86+
> *nuget package **"Generic.Repository.EntityFramework"** is a wrapper around ORM EntityFramework
87+
88+
<hr />
89+
8990
### Support or Contact
9091

9192
Having any trouble? Check out our [documentation](https://github.com/AJEETX/Generic.Repository.EntityFramework/blob/master/README.md) or [contact support](mailto:[email protected]) and we’ll help you sort it out.

0 commit comments

Comments
 (0)