MTaggedMessages() публичный Метод

public MTaggedMessages ( System.Guid AccountId ) : MsgSetBlobPack
AccountId System.Guid
Результат Tigwi.Storage.Library.Utilities.MsgSetBlobPack
Пример #1
0
        public void Tag(Guid accountId, Guid msgId)
        {
            // retrive the message
            Message message = blobFactory.MMessage(msgId).GetIfExists(new MessageNotFound());

            // Tag it
            if (!blobFactory.MTaggedMessages(accountId).AddMessage(message))
            {
                throw new AccountNotFound();
            }
        }
Пример #2
0
        public Guid Create(Guid adminId, string name, string description, bool bypassNameReservation = false)
        {
            Blob <Guid> bIdByName = blobFactory.AIdByName(name);

            // lock the name
            if (!bypassNameReservation)
            {
                if (!bIdByName.SetIfNotExists(Guid.Empty))
                {
                    throw new AccountAlreadyExists();
                }
            }

            Guid accountId = Guid.NewGuid();

            // TODO : we could do it without a lock - or at least store the data before
            using (blobFactory.UAccountsLock(adminId))
            {
                Guid personnalListId = Guid.NewGuid();

                // store the data
                HashSet <Guid> users = new HashSet <Guid>();
                users.Add(adminId);
                blobFactory.AUsers(accountId).Set(users);

                HashSet <Guid> followedByAll = new HashSet <Guid>();
                followedByAll.Add(personnalListId);
                blobFactory.LFollowedByAll(accountId).Set(followedByAll);

                blobFactory.AInfo(accountId).Set(new AccountInfo(name, description));
                blobFactory.AAdminId(accountId).Set(adminId);
                blobFactory.LOwnedListsPublic(accountId).Set(new HashSet <Guid>());
                blobFactory.LOwnedListsPrivate(accountId).Set(new HashSet <Guid>());
                blobFactory.LFollowedListsData(accountId).Set(new HashSet <Guid>());
                blobFactory.LFollowedByPublic(accountId).Set(new HashSet <Guid>());
                blobFactory.LFollowedListsLockInit(accountId);
                blobFactory.MTaggedMessages(accountId).Init();
                blobFactory.AAutocompletion().Add(new KeyValuePair <string, string>(name.GenerateDoubleMetaphone(), name));

                // Setup the personnal list
                blobFactory.LPersonnalList(accountId).Set(personnalListId);
                blobFactory.LInfo(personnalListId).Set(new ListInfo("", "", true, true));
                blobFactory.LOwner(personnalListId).Set(accountId);
                blobFactory.MListMessages(personnalListId).Init();
                blobFactory.LFollowedAccounts(personnalListId).Set(new Dictionary <Guid, bool>());

                // we finish by unlocking the name
                bIdByName.Set(accountId);

                // we make this account accessible
                blobFactory.UAccountsData(adminId).Add(accountId);
            }

            return(accountId);
        }