Пример #1
0
        public static void LoadCategories()
        {
            var category = Connector.Override(Northwind.Connector).Using(_ => Database.View <Categories>().ToList());

            category.Select(s => new CategoryEntity
            {
                CategoryName = s.CategoryName,
                Description  = s.Description,
                Picture      = new FileEmbedded {
                    FileName = s.CategoryName + ".jpg", BinaryFile = EmployeeLoader.RemoveOlePrefix(s.Picture.ToArray())
                },
            }.SetId(s.CategoryID))
            .BulkInsert(disableIdentity: true);
        }
Пример #2
0
 public static void LoadCategories()
 {
     using (NorthwindDataContext db = new NorthwindDataContext())
     {
         Administrator.SaveListDisableIdentity(db.Categories.Select(s =>
                                                                    new CategoryEntity
         {
             CategoryName = s.CategoryName,
             Description  = s.Description,
             Picture      = new EmbeddedFileEntity {
                 FileName = s.CategoryName + ".jpg", BinaryFile = EmployeeLoader.RemoveOlePrefix(s.Picture.ToArray())
             },
         }.SetId(s.CategoryID)));
     }
 }