示例#1
0
文件: Program.cs 项目: pa1ch/Adapter
        static void Main(string[] args)
        {
            var dbUserEntity     = new DbUserEntity();
            var dbUserInfoEntity = new DbUserInfoEntity();

            var firstUserOrm     = new ConcreteFirstOrm <DbUserEntity>();
            var firstUserInfoOrm = new ConcreteFirstOrm <DbUserInfoEntity>();

            var firstOrmAdapter = new FirstOrmAdapter(firstUserOrm, firstUserInfoOrm);
            var firstClient     = new UserClient(firstOrmAdapter);

            firstClient.Add(dbUserEntity, dbUserInfoEntity);

            var secondOrm        = new ConcreteSecondOrm();
            var secondOrmAdapter = new SecondOrmAdapter(secondOrm);
            var secondClient     = new UserClient(secondOrmAdapter);

            secondClient.Add(dbUserEntity, dbUserInfoEntity);
        }
示例#2
0
 public void Add(DbUserEntity user, DbUserInfoEntity userInfo)
 {
     _ormAdapter.Add(user, userInfo);
 }
示例#3
0
 public void Delete(DbUserInfoEntity entity)
 {
     Context.UserInfos.RemoveWhere(u => u.Id == entity.Id);
 }
示例#4
0
 public void Add(DbUserInfoEntity entity)
 {
     Context.UserInfos.Add(entity);
 }