42 lines
963 B
C#
42 lines
963 B
C#
using KanSan.Base.Interfaces;
|
|
using KanSan.Base.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace KanSan.Base
|
|
{
|
|
public class UnitOfWork : IUnitOfWork
|
|
{
|
|
private KanSanContext _dbContext;
|
|
private BaseRepository<Projekt> _baustellen;
|
|
private BaseRepository<Kunde> _kunden;
|
|
|
|
public UnitOfWork(KanSanContext dbContext)
|
|
{
|
|
_dbContext = dbContext;
|
|
}
|
|
|
|
public IRepository<Projekt> BaustellenRepository
|
|
{
|
|
get
|
|
{
|
|
return _baustellen ?? (_baustellen = new BaseRepository<Projekt>(_dbContext));
|
|
}
|
|
}
|
|
|
|
public IRepository<Kunde> KundenRepository
|
|
{
|
|
get
|
|
{
|
|
return _kunden ?? (_kunden = new BaseRepository<Kunde>(_dbContext));
|
|
}
|
|
}
|
|
|
|
public void Commit()
|
|
{
|
|
_dbContext.SaveChanges();
|
|
}
|
|
}
|
|
}
|