VS Implementing database Data migration

Source: Internet
Author: User

   PublicActionResult About () {List<ChangeData.Models.old.adsinfo> adsinfo_new =NewList<models.old.adsinfo> ();//instantiate a list to load the old table            using(Model2 m2 =NewModel2 ()) {adsinfo_new= M2.adsinfo.ToList ();//m2 A piece of data from the ad table and creates a list            }            using(Model1 m1 =NewModel1 ())//Instantiate M1, here is the new table            {                foreach(varIteminchAdsinfo_new)//Traverse Adsinfo_new{Ads Ads=NewAds (); Ads. ATime=Item.adsinfo_inputtime; Ads. Auname=Item.adsinfo_inputername; Ads.isdel= Item.adsinfo_isdel = =1;//int to bool                    intA =0; int. TryParse (Item.adsinfo_order +"", outa); Ads. Sort= A;//decimal Turn intads. Title=Item.adsinfo_title; Ads. IMG="/"+Item.adsinfo_path; Ads. Key=Item.adsinfo_key; Ads. URL=Item.adsinfo_url; M1.                Ads.add (ADS); } M1.            SaveChanges (); }            returnView (); }

VS Implementing database Data migration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.