コード例 #1
0
        public void Add()
        {
            var thumbBits = new byte[100];
            var fullBits  = new byte[2000];

            using (var context = new PhotographContext())
            {
                var photo = new Photograph {
                    Title = "My Dog", ThumbnailBits = thumbBits
                };
                var fullImage = new PhotographFullImage {
                    HighResolutionBits = fullBits
                };
                photo.PhotographFullImage = fullImage;
                context.PhotographSet.Add(photo);
                context.SaveChanges();
            }
        }
コード例 #2
0
        private static void AddPhoto()
        {
            byte[] thumbBits = new byte[100];
            byte[] fullBits  = new byte[2000];
            using var context = new PhotographContext();
            var photo = new Photograph
            {
                Title         = "My Dog",
                ThumbnailBits = thumbBits
            };
            var fullImage = new PhotographFullImage
            {
                HighResolutionBits = fullBits
            };

            photo.PhotographFullImage = fullImage;
            context.Photographs.Add(photo);
            context.SaveChanges();
        }