Esempio n. 1
0
 /// <summary>
 /// Constructor of PersonService class, creates and configures internal LINQ to SQL database context.
 /// </summary>
 /// <param name="connectionString">Custom connection string that specifies database to connect to.</param>
 public PersonService(string connectionString)
 {
     //Possible, but that would limit this library to access project's own "Database.mdf" only
     //context = new PersonsDataContext();
     //Better to configure PersonsDataContext with custom connection string (it might even be the one pointing to project's own "Database.mdf")
     m_Context = new PersonsDataContext(connectionString);
 }
Esempio n. 2
0
        private bool disposedValue = false; // To detect redundant calls

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor of PersonService class, creates and configures internal LINQ to SQL database context.
        /// </summary>
        /// <param name="connectionString">Custom connection string that specifies database to connect to.</param>
        public PersonService(string connectionString)
        {
            /* Possible, but that would limit this library to access project's own "Database.mdf" only
             */
            //context = new PersonsDataContext();

            /* Better to configure PersonsDataContext with custom connection string
             * (it might even be the one pointing to project's own "Database.mdf")
             */
            context = new PersonsDataContext(connectionString);
        }
Esempio n. 3
0
 public PersonService()
 {
     context = new PersonsDataContext();
 }