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
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.high
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);
        }
    }
}