コード例 #1
0
        public static void Main()
        {
            var context = new PhotographySystemEntities();

            var photographs = GetPhotographsData(context);

            var photographsDoc = CreateXmlDocument(photographs);

            photographsDoc.Save("../../photographs.xml");
        }
コード例 #2
0
        public static void Main()
        {
            var context = new PhotographySystemEntities();

            var cameraManufacturersModels = context.Cameras
                .Select(c => new
                {
                    ManufacturerModel = c.Manufacturer.Name + " " + c.Model
                })
                .OrderBy(c => c.ManufacturerModel);

            foreach (var camera in cameraManufacturersModels)
            {
                Console.WriteLine(camera.ManufacturerModel);
            }
        }
コード例 #3
0
 private static List<PhotographExportModel> GetPhotographsData(PhotographySystemEntities context)
 {
     var photographs = context.Photographs
         .Select(p => new PhotographExportModel
         {
             Title = p.Title,
             CategoryName = p.Category.Name,
             Link = p.Link,
             CameraModel = p.Equipment.Camera.Model,
             CameraMegaPixels = p.Equipment.Camera.Megapixels,
             LensPrice = p.Equipment.Lens.Price,
             LensModel = p.Equipment.Lens.Model
         })
         .OrderBy(p => p.Title)
         .ToList();
     return photographs;
 }