Пример #1
0
        public void AddLink(string obj, LoginProfile profile)
        {
            var db = DbOptions.Get(DbId);

            db.ExecuteScalar <int>(
                new SqlInsert("account_links", true)
                .InColumnValue("id", obj)
                .InColumnValue("uid", profile.HashId)
                .InColumnValue("provider", profile.Provider)
                .InColumnValue("profile", profile.ToSerializedString())
                .InColumnValue("linked", DateTime.UtcNow)
                );
            AccountLinkerStorage.RemoveFromCache(obj);
        }
Пример #2
0
        public void AddLink(string obj, LoginProfile profile)
        {
            var accountLink = new AccountLinks
            {
                Id       = obj,
                UId      = profile.HashId,
                Provider = profile.Provider,
                Profile  = profile.ToSerializedString(),
                Linked   = DateTime.UtcNow
            };

            AccountLinkContext.AddOrUpdate(r => r.AccountLinks, accountLink);
            AccountLinkContext.SaveChanges();

            AccountLinkerStorage.RemoveFromCache(obj);
        }
Пример #3
0
        public void AddLink(string obj, LoginProfile profile)
        {
            CacheEntry.Reset(obj);

            using (var db = new DbManager(_dbid))
            {
                db.ExecuteScalar <int>(
                    new SqlInsert(LinkTable, true)
                    .InColumnValue("id", obj)
                    .InColumnValue("uid", profile.HashId)
                    .InColumnValue("provider", profile.Provider)
                    .InColumnValue("profile", profile.ToSerializedString())
                    .InColumnValue("linked", DateTime.UtcNow)
                    );
            }
        }
Пример #4
0
 public void AddLink(string obj, LoginProfile profile)
 {
     using (var db = new DbManager(dbid))
     {
         db.ExecuteScalar <int>(
             new SqlInsert("account_links", true)
             .InColumnValue("id", obj)
             .InColumnValue("uid", profile.HashId)
             .InColumnValue("provider", profile.Provider)
             .InColumnValue("profile", profile.ToSerializedString())
             .InColumnValue("linked", DateTime.UtcNow)
             );
     }
     notify.Publish(new LinkerCacheItem {
         Obj = obj
     }, CacheNotifyAction.Remove);
 }
Пример #5
0
 public void AddLink(string obj, LoginProfile profile)
 {
     using (var db = new DbManager(dbid))
     {
         using (var tx = db.BeginTransaction())
         {
             db.ExecuteScalar <int>(
                 new SqlInsert(LinkTable, true)
                 .InColumnValue("id", obj)
                 .InColumnValue("uid", profile.HashId)
                 .InColumnValue("provider", profile.Provider)
                 .InColumnValue("profile", profile.ToSerializedString())
                 .InColumnValue("linked", DateTime.UtcNow)
                 );
             tx.Commit();
         }
     }
 }