当前位置: 首页>>代码示例>>C#>>正文


C# DataSource类代码示例

本文整理汇总了C#中DataSource的典型用法代码示例。如果您正苦于以下问题:C# DataSource类的具体用法?C# DataSource怎么用?C# DataSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DataSource类属于命名空间,在下文中一共展示了DataSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: initializeRoutes

        public async static Task initializeRoutes()
        {
            //var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(@"routeconfig.txt");
            Assembly assem = typeof(API).GetTypeInfo().Assembly;
            var names = assem.GetManifestResourceNames();
            var stream = assem.GetManifestResourceStream("NextBusParser.routeconfig.txt");
            StreamReader reader = new StreamReader(stream);
            
            string routedata = await reader.ReadToEndAsync();

            DataSource ds = JsonConvert.DeserializeObject<DataSource>(routedata);
            _ds = ds;
            reader.Dispose();

            foreach (Route r in ds.Routes)
            {
                foreach (Direction d in r.Directions)
                {
                    for (int i = 0; i < d.Stops.Count; i++)
                    {
                        Stop s = d.Stops[i];
                        s = r.Stops.Where(e => e.Tag.Equals(s.Tag)).First();
                        d.Stops[i] = s;
                    }
                }
            }

            _isInitialized = true;
        }
开发者ID:abettadapur,项目名称:NextBusMX,代码行数:29,代码来源:API.cs

示例2: LoadDatabases

        /// <summary>
        /// Get list of DBs which can be accessed by worker
        /// </summary>
        public static List<WorkerDb> LoadDatabases(DataSource source)
        {
            List<WorkerDb> result = new List<WorkerDb>();

            var csBuilder = new SqlConnectionStringBuilder();
            csBuilder.DataSource = source.Address;
            csBuilder.UserID = source.Username;
            csBuilder.Password = source.Password;

            var conn = new SqlConnection(csBuilder.ConnectionString);
            var cmd = new SqlCommand(GetSuitableDatabases, conn);
            cmd.Parameters.AddWithValue("@pattern", source.SearchPattern);
            conn.Open();

            var reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                var name = reader.GetString(0);
                var id = Regex
                    .Replace(name, source.NameRegex, string.Empty)
                    .ToLower();

                var db = new WorkerDb();
                db.Id = id;
                csBuilder.InitialCatalog = name;
                db.ConnectionString = csBuilder.ConnectionString;

                result.Add(db);
            }

            conn.Close();

            return result;
        }
开发者ID:ddreaddnought,项目名称:db-octopus,代码行数:37,代码来源:InitHelper.cs

示例3: UpdateDataSource

 public DataSource UpdateDataSource(DataSource dataSource, string accountId)
 {
     var ds = Mapper.Map<DataSource, DynamoDb.DataSource>(dataSource);
     ds.AccountId = accountId;
     this.Context.Save(ds);
     return dataSource;
 }
开发者ID:Naviam,项目名称:Log-Analyzer,代码行数:7,代码来源:DataSourceRepository.cs

示例4: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			// Perform any additional setup after loading the view, typically from a nib.
			//NavigationItem.LeftBarButtonItem = EditButtonItem;

//			var addButton = new UIBarButtonItem (UIBarButtonSystemItem.Add, AddNewItem);
//			NavigationItem.RightBarButtonItem = addButton;

			MainSearchBar.SearchButtonClicked += (object sender, EventArgs e) => 
			{
				_kunden = BusinessLayer.Kunde.GetKunden(MainSearchBar.Text,ref  AppDelegate._user , false);
				dataSource.SetSource(_kunden);
//					TableView.Source = new SpeakersTableSource (_kunden);
				TableView.ReloadData();
			};




			//TODO: Step 1a: uncomment to set SpeakersTableSource as the TableView Source
			dataSource = new DataSource (this);
			TableView.Source = dataSource;
			//TableView.Source = dataSource ;

		}
开发者ID:MbProg,项目名称:MasterDetailTestProject-IOS-64,代码行数:27,代码来源:MasterViewController.cs

示例5: Should_be_able_prepare_a_query

        public void Should_be_able_prepare_a_query()
        {
            const string sql = "select @Id";

            var guid = Guid.NewGuid();
            var mc = new MappedColumn<Guid>("Id", DbType.Guid);
            var query = new RawQuery(sql).AddParameterValue(mc, guid);
            var dataParameterCollection = new Mock<IDataParameterCollection>();
            var dataParameterFactory = new Mock<IDbDataParameterFactory>();

            dataParameterFactory.Setup(m => m.Create("@Id", DbType.Guid, guid));

            var dataSource = new DataSource("data-source", dataParameterFactory.Object);

            var command = new Mock<IDbCommand>();

            dataParameterCollection.Setup(m => m.Add(It.IsAny<IDbDataParameter>())).Verifiable();

            command.SetupGet(m => m.Parameters).Returns(dataParameterCollection.Object);
            command.SetupSet(m => m.CommandText = sql).Verifiable();
            command.SetupSet(m => m.CommandType = CommandType.Text).Verifiable();

            query.Prepare(dataSource, command.Object);

            command.VerifyAll();
            dataParameterFactory.VerifyAll();
        }
开发者ID:ltvan,项目名称:shuttle-core-data,代码行数:27,代码来源:RawQueryTests.cs

示例6: DefineDatabaseConnectionMenuItem_OnClick

        private void DefineDatabaseConnectionMenuItem_OnClick(object sender, RoutedEventArgs e)
        {
            // Build the data source, hard-coded to SQL Server
            DataSource sqlDataSource = new DataSource("MicrosoftSqlServer", "Microsoft SQL Server");
            sqlDataSource.Providers.Add(DataProvider.SqlDataProvider);

            // Construct the data connection dialog, add the SQL Server data source, and set to default
            DataConnectionDialog dbConnectionDialog = new DataConnectionDialog();
            dbConnectionDialog.DataSources.Add(sqlDataSource);
            dbConnectionDialog.SelectedDataProvider = DataProvider.SqlDataProvider;
            dbConnectionDialog.SelectedDataSource = sqlDataSource;

            // When user clicks OK, grab the connection string and parse through it
            if (DataConnectionDialog.Show(dbConnectionDialog) == System.Windows.Forms.DialogResult.OK)
            {
                if (_simInstanceDirector.IsConnectionStringValid(dbConnectionDialog.ConnectionString))
                {
                    // Save off the validated connection string for future use on restart
                    Settings.Default.ExperimentDbConnectionString =
                        _simInstanceDirector.GetEntityFormatConnectionString(dbConnectionDialog.ConnectionString);
                    Settings.Default.Save();

                    // Enable the database experiment selection option
                    LoadDatabaseExperimentConfigurationMenuItem.IsEnabled = true;
                }
                else
                {
                    MessageBox.Show("Couldn't connect to the database using the provided connection information.",
                        "Error Connecting to Data Source", MessageBoxButton.OK, MessageBoxImage.Exclamation);

                    // Reset the database experiment selection option
                    LoadDatabaseExperimentConfigurationMenuItem.IsEnabled = false;
                }
            }
        }
开发者ID:jbrant,项目名称:SharpNoveltyNeat,代码行数:35,代码来源:MainWindow.xaml.cs

示例7: fillVars

 void fillVars()
 {
     UIController = LifetimeService.Instance.Container.Resolve<IUIController>();
     ds = UIController.GetActiveDocument();
     if (ds == null)
     {
         canExecute = false;
         return;
     }
     Variables = new ObservableCollection<DataSourceVariable>(ds.Variables);
     source.ItemsSource = ds.Variables;
     //source.Items.Add("AA");
     //source.Items.Add("BB");
     //source.Items.Add("CC");
     //source.Items.Add("DD");
     //source.Items.Add("EE");
     //source.Items.Add("FF");
     //source.Items.Add("GG");
     //source.Items.Add("HH");
     //source.Items.Add("II");
     //source.Items.Add("JJ");
     //source.Items.Add("KK");
     //source.Items.Add("LL");
     //source.Items.Add("MM");
     //source.Items.Add("NN");
     //source.Items.Add("OO");
     ////////////// Function catagory /////////
     funcat.Items.Add("All");
     funcat.Items.Add("Arithmetic");
     funcat.Items.Add("CDF & Noncentral CDF");
     funcat.Items.Add("Conversion");
     funcat.Items.Add("Current Date/Time");
     funcat.Items.Add("Date Arithmetic");
     funcat.Items.Add("Date Creation");
 }
开发者ID:BlueSkyStatistics,项目名称:BlueSkyRepository,代码行数:35,代码来源:ComputeVar.xaml.cs

示例8: RequestData

 public Bars RequestData(DataSource ds, string symbol, DateTime startDate, DateTime endDate, int maxBars, bool includePartialBar)
 {
     Bars bars = new Bars(symbol, ds.Scale, ds.BarInterval);
     //bars.Add(new DateTime(2012, 04, 07), 2, 5, 1, 3, 5);
     //bars.Add(new DateTime(2010, 09, 06), 3, 6, 2, 2, 6);
     return bars;
 }
开发者ID:cheetahray,项目名称:Projects,代码行数:7,代码来源:Zaglushka.cs

示例9: MainWindow

        public MainWindow()
        {
            InitializeComponent();

               dataSource = new DataSource();
            this.DataContext = dataSource;
        }
开发者ID:agurha,项目名称:fixwords,代码行数:7,代码来源:MainWindow.xaml.cs

示例10: SqlQueue

        public SqlQueue(Uri uri,
						IScriptProvider scriptProvider,
						IDatabaseConnectionFactory databaseConnectionFactory,
						IDatabaseGateway databaseGateway)
        {
            Guard.AgainstNull(uri, "uri");
            Guard.AgainstNull(scriptProvider, "scriptProvider");
            Guard.AgainstNull(databaseConnectionFactory, "databaseConnectionFactory");
            Guard.AgainstNull(databaseGateway, "databaseGateway");

            _scriptProvider = scriptProvider;
            _databaseConnectionFactory = databaseConnectionFactory;
            _databaseGateway = databaseGateway;

            _log = Log.For(this);

            Uri = uri;

            parser = new SqlUriParser(uri);

            _dataSource = new DataSource(parser.ConnectionName, new SqlDbDataParameterFactory());
            _tableName = parser.TableName;

            BuildQueries();
        }
开发者ID:jessezhao,项目名称:shuttle-esb,代码行数:25,代码来源:SqlQueue.cs

示例11: authorizedConnect

 public override object authorizedConnect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource)
 {
     object result = base.authorizedConnect(credentials, permission, validationDataSource);
     //_eventArgs.ConnectionEventType = ConnectionPoolEventArgs.ConnectionChangeEventType.ConnectionAvailable;
     //OnChanged(_eventArgs);
     return result;
 }
开发者ID:ChristopherEdwards,项目名称:MDWS,代码行数:7,代码来源:VistaConnectionPoolConnection.cs

示例12: MediatorServer

 public MediatorServer(SystemConfiguration systemConfig, DataSource dataSource)
 {
     config = systemConfig.Servers.First(kvp => kvp.Value.Type == ServerTypes.Mediator).Value;
     controller = new Controller(dataSource);
     //			bootstrapper = new MediatorBootstrapper(controller);
     bootstrapper = new ApiBootstrapper(controller);
 }
开发者ID:AnObfuscator,项目名称:Dispartior,代码行数:7,代码来源:MediatorServer.cs

示例13: ViewDidLoad

		public async override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			var query = ParseObject.GetQuery("Item")
				.WhereEqualTo("PurchaserName", PersonDetailViewController.Instance.CurrentPerson.ID);
			
			IEnumerable<ParseObject> results = await query.FindAsync();

			ParseObj = results.ToList ();
			foreach (ParseObject po in ParseObj) {
				string Desc = po.Get<string> ("Description");
				string Value = po.Get<string> ("Value");
				bool Available = po.Get<Boolean> ("Available");
				PurchasedItems.Add (new Items { 
					Description = Desc,
					Value = Value, 
					Available = Available
				});
			}

			this.NavigationItem.SetRightBarButtonItem(
				new UIBarButtonItem(UIBarButtonSystemItem.Add, (sender,args) => {
					// button was clicked
				})
				, true);
			
			TableView.Source = dataSource = new DataSource(this, PurchasedItems);
			TableView.ReloadData ();
			this.Title = "Total=> ";
		}
开发者ID:meetdpanda,项目名称:Gala,代码行数:31,代码来源:ActivityListTableViewController.cs

示例14: HeaderRecord

 public HeaderRecord(DataSource source, ThreeLetterCode code, string text, string value)
     : base(RecordType.H, text)
 {
     DataSource = source;
     ThreeLetterCode = code;
     Value = value ?? string.Empty;
 }
开发者ID:p3rl,项目名称:DotIGC,代码行数:7,代码来源:HeaderRecord.cs

示例15: DataSourceConventions

 public void DataSourceConventions(DataSource<string> sut, int expectedCount)
 {
     var collection = sut.Data.ToList();
     collection.Count.ShouldBe(expectedCount);
     collection.Count.ShouldBe(sut.Data.Distinct().ToList().Count);
     collection.ForEach(item => item.ShouldNotBeNullOrEmpty());
 }
开发者ID:EricDoherty,项目名称:TestStack.Dossier,代码行数:7,代码来源:DataSourceConventionTests.cs


注:本文中的DataSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。