aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.DAL.Local/Partials/LocalDB.cs
blob: db66f1c0a5599b2daa8d1f47e64baf06ee7154d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.DAL.Local.DB
{
    /// <summary>
    /// Represents an SQLite database context.
    /// </summary>
    /// <seealso cref="System.Data.Entity.DbContext" />
    public partial class LocalDB : DbContext
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="LocalDB"/> class.
        /// </summary>
        /// <param name="filePath">The file path.</param>
        public LocalDB(String filePath) : base(ComposeConnectionString(filePath))
        {

        }

        /// <summary>
        /// Composes the connection string.
        /// </summary>
        /// <param name="filePath">The file path.</param>
        /// <returns></returns>
        private static String ComposeConnectionString(String filePath)
        {
            return String.Format("metadata=res://*/DB.LocalADO.csdl|res://*/DB.LocalADO.ssdl|res://*/DB.LocalADO.msl;provider=System.Data.SQLite.EF6;provider connection string=\"data source={0}\"", filePath);
        }
    }
}