示例#1
0
        // Temp constructor till I get IOC wired up
        public ProcessLogViewModel()
        {
            var databaseConfigFileName = "EdhLogViewer.database.config";
            var installationDirectory  = @"c:\Dev\EdhLogViewer\DataAccess";
            var databaseConfig         = System.IO.Path.Combine(installationDirectory, databaseConfigFileName);
            var mappingSource          = XmlMappingSource.FromUrl(databaseConfig);

            EdhLogDataContext = new EdhLogDataContext("Data Source=EDHDBSIT01,65000;Initial Catalog=ODS_SIT01;Integrated Security=True", mappingSource, false, 60);


            RetrieveByProcessNameCommand = new DelegateCommand <string>(new Action <string>(i =>
            {
                LogMessages = new ObservableCollection <ProcessLog>(EdhLogDataContext.NameStartsWithQuery(i));
                OnPropertyChanged("LogMessages");
            }));

            RetrieveByParamsCommand = new DelegateCommand <QueryParamsViewModel>(new Action <QueryParamsViewModel>(i =>
            {
                var queryParams         = new QueryParams();
                queryParams.ProcessName = i.ProcessName;

                queryParams.StartDate = i.FromDateTime;
                queryParams.EndDate   = i.ToDateTime;

                LogMessages = new ObservableCollection <ProcessLog>(EdhLogDataContext.ParamsQuery(queryParams));
                OnPropertyChanged("LogMessages");
            }));

            QueryParamsViewModel = new QueryParamsViewModel();

            //LogMessages = new ObservableCollection<ProcessLog> (EdhLogDataContext.NameStartsWithQuery("1000"));
        }
示例#2
0
        //[TestMethod]
        public void TestTableMappingName()
        {
            var xmlMapping = XmlMappingSource.FromUrl("Northwind.Oracle.map");
            var model      = xmlMapping.GetModel(typeof(NorthwindDemo.NorthwindDatabase));
            var metaTable  = model.GetTable(typeof(NorthwindDemo.Contact));

            Assert.AreEqual("Contacts", metaTable.TableName);
        }
        public DatabaseFixture()
        {
            var databaseConfigFileName = "AnalyticViewer.database.config";
            var installationDirectory  = @"c:\Dev\AnalyticsViewer\AvDataAccess";
            var databaseConfig         = System.IO.Path.Combine(installationDirectory, databaseConfigFileName);
            var mappingSource          = XmlMappingSource.FromUrl(databaseConfig);

            AvDataContext = new AvDataContext("Data Source=lonbscadsqlbl01;Initial Catalog=CADIS_E2E01;Integrated Security=True", mappingSource, false, 30);
        }
示例#4
0
        public virtual void RegisterInstances()
        {
            AppConfiguration = Container.Resolve <IAppConfiguration>();
            var connectionString = AppConfiguration.DatabaseConnection;

            var mappingSource = XmlMappingSource.FromUrl(AppConfiguration.DatabaseConfigFilename);
            var timeout       = AppConfiguration.DatabaseTimeout;

            repository = new AvDataContext(connectionString, mappingSource, false, timeout);

            Container.RegisterInstance <IUnitOfWork>(repository);
        }
示例#5
0
        public override NorthwindDatabase CreateDataBaseInstace()
        {
            var xmlMapping = XmlMappingSource.FromUrl("Northwind.SQL2000.map");

            writer = Console.Out;
            var constr  = @"Data Source=vpc1\SQLEXPRESS;Initial Catalog=Northwind;User ID=sa;PASSWORD=test";
            var builder = new SqlConnectionStringBuilder(constr);

            return(new Sql2000Northwind(new SqlConnection(builder.ToString()))
            {
                Log = writer
            });                                                                                 //, xmlMapping
        }
示例#6
0
 public DatabaseFixture()
 {
     if (UseFakeContext)
     {
         EdhLogDataContext = new EdhLogFakeDataContext();
     }
     else
     {
         var databaseConfigFileName = "EdhLogViewer.database.config";
         var installationDirectory  = @"c:\Dev\EdhLogViewer\DataAccess";
         var databaseConfig         = System.IO.Path.Combine(installationDirectory, databaseConfigFileName);
         var mappingSource          = XmlMappingSource.FromUrl(databaseConfig);
         EdhLogDataContext = new EdhLogDataContext("Data Source=EDHDBSIT01,65000;Initial Catalog=ODS_SIT01;Integrated Security=True", mappingSource, false, 30);
     }
 }
示例#7
0
        /// <summary>
        /// 1) SQLMetal /Server:(localdb)\MSSQLLocalDB /Database:BookLibrary /Namespace:LinqToSqlMetal /Code:BookLibrary.CS /Map:BookLibrary.XML /Pluralize /Functions /Sprocs /Views
        ///     this command generate sqlmetal files to work with database it has all required syntaxes and create according to it
        ///     for more :  http://msdn2.microsoft.com/en-us/library/bb386987.aspx.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            string connectionString = @"Data Source=(localdb)\mssqllocaldb;Initial Catalog=BookLibrary;Integrated Security=True";
            //Creating xml mapping
            XmlMappingSource mappingSource = XmlMappingSource.FromUrl(@"C:\Users\Sumitkiran.Gaurav\source\repos\LinqToSqlMetal\LinqToSqlMetal\BookLibrary.XML");

            // creating datacontext
            BookLibrary bookLibraryContext = new BookLibrary(connectionString, mappingSource);

            IEnumerable <Bookdata> result = from book in bookLibraryContext.Bookdatas
                                            where book.Title.Contains("India")
                                            select book;

            foreach (Bookdata book in result)
            {
                Console.WriteLine(book);
            }
        }
        public XmlMappingSourceFromUrlProvider(string filename)
        {
            var workingDir = new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile).DirectoryName;

            MappingSource = XmlMappingSource.FromUrl(Path.Combine(workingDir, filename));
        }