示例#1
0
        public SavedArtists()
        {
            logger = new DebugLogger();
            mediaFactory = new MediaFactory(logger);
            securityContext = new SecurityContext(mediaFactory);
            mediaType = mediaFactory.GetMediaType("application/vnd.gnosis.artist");

            artist1 = new Gnosis.Metadata.Artist(new IdentityInfo(Guid.NewGuid().ToUrn(), mediaType, "Radiohead", string.Empty, new DateTime(1985, 1, 2), DateTime.MaxValue, 0), SizeInfo.Default, CreatorInfo.Default, CatalogInfo.Default, TargetInfo.Default, UserInfo.Default, new ThumbnailInfo(new Uri("http://example.com/image.jpg"), new byte[0]));
            artist2 = new Gnosis.Metadata.Artist(new IdentityInfo(Guid.NewGuid().ToUrn(), mediaType, "Tool", string.Empty, new DateTime(1991, 2, 28), DateTime.MaxValue, 0), SizeInfo.Default, CreatorInfo.Default, CatalogInfo.Default, TargetInfo.Default, UserInfo.Default, new ThumbnailInfo(new Uri("http://example.com/image2.jpg"), new byte[0]));
            artist3 = new Gnosis.Metadata.Artist(new IdentityInfo(Guid.NewGuid().ToUrn(), mediaType, "Cat Power", string.Empty, new DateTime(1997, 10, 15), DateTime.MaxValue, 0), SizeInfo.Default, CreatorInfo.Default, CatalogInfo.Default, TargetInfo.Default, UserInfo.Default, new ThumbnailInfo(new Uri("http://example.com/image3.jpg"), new byte[0]));
            artist4 = new Gnosis.Metadata.Artist(new IdentityInfo(Guid.NewGuid().ToUrn(), mediaType, "PJ Harvey", string.Empty, new DateTime(2011, 11, 11), DateTime.MaxValue, 0), SizeInfo.Default, CreatorInfo.Default, CatalogInfo.Default, TargetInfo.Default, UserInfo.Default, new ThumbnailInfo(new Uri("http://example.com/image4.jpg"), new byte[0]));

            connection = connectionFactory.Create(connectionString);
            connection.Open();
            repository = new SQLiteMetadataRepository(logger, securityContext, mediaFactory, connection);
            repository.Initialize();
            repository.Save(new List<IArtist> { artist1, artist2 });
        }
示例#2
0
        public SavedAlbums()
        {
            logger = new DebugLogger();
            mediaFactory = new MediaFactory(logger);
            securityContext = new SecurityContext(mediaFactory);
            mediaType = mediaFactory.GetMediaType("application/vnd.gnosis.album");

            album1 = new Album(new IdentityInfo(Guid.NewGuid().ToUrn(), mediaType, "OK Computer", string.Empty, new DateTime(1997, 9, 22), new DateTime(1997, 9, 22), 0), SizeInfo.Default, new CreatorInfo(new Uri(radioheadUrn), "Radiohead"), CatalogInfo.Default, TargetInfo.Default, UserInfo.Default, new ThumbnailInfo(new Uri("http://example.com/image1.jpg"), new byte[0]));
            album2 = new Album(new IdentityInfo(Guid.NewGuid().ToUrn(), mediaType, "Undertow", string.Empty, new DateTime(1992, 3, 28), new DateTime(1992, 3, 28), 0), SizeInfo.Default, new CreatorInfo(Guid.NewGuid().ToUrn(), "Tool"), CatalogInfo.Default, TargetInfo.Default, UserInfo.Default, new ThumbnailInfo(new Uri("http://example.com/image2.jpg"), new byte[0]));
            album3 = new Album(new IdentityInfo(Guid.NewGuid().ToUrn(), mediaType, "Free", string.Empty, new DateTime(2002, 7, 9), new DateTime(2002, 7, 9), 0), SizeInfo.Default, new CreatorInfo(Guid.NewGuid().ToUrn(), "Cat Power"), CatalogInfo.Default, TargetInfo.Default, UserInfo.Default, new ThumbnailInfo(new Uri("http://example.com/image3.jpg"), new byte[0]));
            album4 = new Album(new IdentityInfo(Guid.NewGuid().ToUrn(), mediaType, "White Chalk", string.Empty, new DateTime(2008, 4, 30), new DateTime(2008, 4, 30), 0), SizeInfo.Default, new CreatorInfo(Guid.NewGuid().ToUrn(), "PJ Harvey"), CatalogInfo.Default, TargetInfo.Default, UserInfo.Default, new ThumbnailInfo(new Uri("http://example.com/image4.jpg"), new byte[0]));
            album5 = new Album(new IdentityInfo(Guid.NewGuid().ToUrn(), mediaType, "Pablo Honey", string.Empty, new DateTime(1993, 4, 4), new DateTime(1993, 4, 4), 0), SizeInfo.Default, new CreatorInfo(new Uri(radioheadUrn), "Radiohead"), CatalogInfo.Default, TargetInfo.Default, UserInfo.Default, new ThumbnailInfo(new Uri("http://example.com/image5.jpg"), new byte[0]));

            connection = connectionFactory.Create(connectionString);
            connection.Open();
            repository = new SQLiteMetadataRepository(logger, securityContext, mediaFactory, connection);
            repository.Initialize();
            repository.Save(new List<IAlbum> { album1, album2, album5 });
        }