Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace LibDataAccess {
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using Microsoft.Data.Entity;
- using Models;
- using Microsoft.Data.Entity.Metadata;
- public class MyDBContext : DbContext {
- public MyDBContext Save<T>(T entity) where T : class {
- this.Add<T>(entity: entity);
- try {
- this.SaveChanges();
- } catch (Exception ex) {
- throw;
- }
- return this;
- }
- public MyDBContext Save(object entity) {
- this.Add(entity: entity);
- try {
- this.SaveChanges();
- } catch (Exception ex) {
- throw;
- }
- return this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement