Beispiel #1
0
        public void EnsureRegistered()
        {
            var webResourceId = WebResourceRepository.FirstOrDefault(r => r.Uuid == WebResourceUuids.Vk, r => r.Id);

            if (webResourceId == 0)
            {
                var resource = new WebResource
                {
                    Uuid     = WebResourceUuids.Vk,
                    Name     = WebResourceName,
                    Url      = WebResourceUrl,
                    ImageUrl = WebResourceImageUrl
                };

                WebResourceRepository.Save(resource);
                UnitOfWork.Commit();

                webResourceId = resource.Id;
            }

            var isProviderRegistered = PersonMetaProviderRepository.Any(r => r.Uuid == PersonMetaProviderUuid);

            if (!isProviderRegistered)
            {
                PersonMetaProviderRepository.Save(new PersonMetaProvider
                {
                    Uuid          = PersonMetaProviderUuid,
                    Name          = typeof(VkWatch).FullName,
                    WebResourceId = webResourceId
                });

                UnitOfWork.Commit();
            }
        }