PageRenderTime 19ms CodeModel.GetById 17ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/eCarona/DataBaseContext.cs

https://github.com/ednerzuconelli/eCaronaMobile
C# | 40 lines | 32 code | 8 blank | 0 comment | 3 complexity | af8dbbc6a20b60f8ec683afc41d843c9 MD5 | raw file
 1using System;
 2using System.Collections;
 3using System.Linq;
 4using System.Text;
 5using System.Threading.Tasks;
 6using System.Data.Linq;
 7using System.Data.Linq.Mapping;
 8using Microsoft.Phone.Data.Linq;
 9using Microsoft.Phone.Data.Linq.Mapping;
10
11
12namespace eCarona
13{
14    class DataBaseContext: DataContext
15    {
16        public static string ConnectionString = "Data Source=isostore:/Configuracoes.sdf";
17
18        private Table<Configuracao> configuracoes;
19
20        public Table<Configuracao> Configuracoes
21        {
22            get
23            {
24                if (configuracoes == null)
25
26                    configuracoes = GetTable<Configuracao>();
27
28                return configuracoes;
29            }
30        }
31
32        public DataBaseContext(string connectionString)
33            : base(connectionString)
34        {
35            if (!this.DatabaseExists())
36                this.CreateDatabase();
37        }
38
39    }
40}