Generic.Repository.EntityFramework
1.13.0
dotnet add package Generic.Repository.EntityFramework --version 1.13.0
NuGet\Install-Package Generic.Repository.EntityFramework -Version 1.13.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Generic.Repository.EntityFramework" Version="1.13.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Generic.Repository.EntityFramework --version 1.13.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Generic.Repository.EntityFramework, 1.13.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Generic.Repository.EntityFramework as a Cake Addin
#addin nuget:?package=Generic.Repository.EntityFramework&version=1.13.0
// Install Generic.Repository.EntityFramework as a Cake Tool
#tool nuget:?package=Generic.Repository.EntityFramework&version=1.13.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Generic.Repository.EntityFramework
Purpose of statement
In order to perform database CRUD operation from .net application,
the wrapper makes it quite easy by following the below steps.
Steps to use the package
In VS2015 or above, Create .net application [.net4.6.1] to interact with Sql server database
IDbContext type is inherited from the installed package
using Generic.Repository.EntityFramework; //add this reference
//DB is real data model created from database
public partial class DB : DbContext, IDbContext
{
public DB() : base("name=connectionstring"){}
IDbSet<T> IDbContext.Set<T>()
{
return base.Set<T>();
}
public DbSet<Customer> Customers {get;set;}
public int Save()
{
return base.SaveChanges();
}
....
}
- Now all set, please add the below lines from your consuming object/component
//add these 2 references
using Generic.Repository.EntityFramework;
using Unity;
public class ConsumeService
{
...
void ConsumeMethod()
{
var container = UnityConfig.Container; //get the Unity container
container.RegisterType<IDbContext, DB>(); // register your 'DataModel'
var dbManager=container.Resolve<IDBManager>(); //get the db manager
//All wired up. DO YOUR CRUD OPERATION & Customer is the table name in DB
var result=dbManager.GetRepository<Customer>().Get(); //GET All
//FIND by id, where id is the primary key
var result=dbManager.GetRepository<Customer>().Find(id);
// custObj is the Customer object
var result=dbManager.GetRepository<Customer>().Add(custObj); //ADD
var result=dbManager.GetRepository<Customer>().Update(custObj); // UPDATE
var result=dbManager.GetRepository<Customer>().Delete(custObj); // DELETE
}
*nuget package "Generic.Repository.EntityFramework" is a wrapper around ORM EntityFramework
Support or Contact
Having any trouble? Check out our documentation or contact support and we’ll help you sort it out.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
- EntityFramework (>= 6.2.0)
- Unity (>= 5.7.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.13.0 | 1,044 | 5/22/2018 |