示例#1
0
        void InitDatabase()
        {
            using (var xcontext = new Data.xDbContext())
            {
                xcontext.Database.Initialize(true);
                Data.Movie _m = new Data.Movie()
                {
                    //M_UID = Guid.NewGuid(),
                    M_ReleaseID    = "AAA-021",
                    M_ReleaseTitle = "SAMPLE TITLE",
                    M_ReleaseDate  = new DateTime(2016, 5, 15)
                };
                xcontext.Movies.Add(_m);
                xcontext.SaveChanges();

                _m_list = new ObservableCollection <Data.Movie>((from m in xcontext.Movies
                                                                 orderby m.M_ReleaseID
                                                                 select m).ToList <Data.Movie>());
                //DataContext = _m_list;
                //SampleList.ItemsSource = _m_list;
                //_m_list.ForEach(m => SampleList.Items.Add(m));
            }
        }
示例#2
0
 public DataService()
 {
     context = new xDbContext();
     context.Database.CreateIfNotExists();
 }