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


C# IDnaDataReader.Execute方法代码示例

本文整理汇总了C#中IDnaDataReader.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader.Execute方法的具体用法?C# IDnaDataReader.Execute怎么用?C# IDnaDataReader.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDnaDataReader的用法示例。


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

示例1: BuildSnesEvents

 private static IEnumerable<ISnesActivity> BuildSnesEvents(IDnaDataReader reader)
 {
     var activities = new List<ISnesActivity>();
     reader.Execute();
     if (reader.HasRows)
     {
         while (reader.Read())
         {
             activities.Add(SnesActivityFactory.CreateSnesActivity(SnesActivityLogger, reader));
         }
     }
     return activities;
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:13,代码来源:SnesActivityProcessor.cs

示例2: MockCurrentRowDataReader

        private static void MockCurrentRowDataReader(IDnaDataReader reader)
        {
            Expect.Call(reader.Execute()).Return(reader);
            Expect.Call(reader.HasRows).Return(true);
            var readReturn = new Queue<bool>();
            readReturn.Enqueue(true);
            readReturn.Enqueue(false);
            Expect.Call(reader.Read()).Return(true).WhenCalled( x => x.ReturnValue = readReturn.Dequeue());
            Expect.Call(reader.Dispose);
            Expect.Call(reader.GetString("AppId")).Return("iPlayer");
            Expect.Call(reader.GetString("IdentityUserId")).Return("0");

            //Expect.Call(reader.GetInt32NullAsZero("PostId")).Repeat.Times(2).Return(1);

            //Expect.Call(reader.GetStringNullAsEmpty("DnaUrl")).Return("http://www.bbc.co.uk/dna/");
            //Expect.Call(reader.GetInt32NullAsZero("ForumID")).Repeat.Any().Return(1234);
            //Expect.Call(reader.GetInt32NullAsZero("ThreadId")).Repeat.Any().Return(54321);
            //Expect.Call(reader.GetInt32("ActivityType")).Repeat.Times(2).Return(5);
            //Expect.Call(reader.GetInt32("EventID")).Return(1234);
            //string appId = Guid.NewGuid().ToString();
            //Expect.Call(reader.GetStringNullAsEmpty("AppId")).Return(appId);
            //Expect.Call(reader.GetStringNullAsEmpty("Body")).Return("here is some text");
            //DateTime now = new DateTime(1970, 1, 1, 0, 0, 0);
            //Expect.Call(reader.GetDateTime("ActivityTime")).Return(now);
            //Expect.Call(reader.GetInt32("IdentityUserId")).Return(12345456);
            //Expect.Call(reader.GetStringNullAsEmpty("AppName")).Return("iPlayer");

            //Expect.Call(reader.GetStringNullAsEmpty("BlogUrl")).Repeat.Times(2).Return("http://www.bbc.co.uk/blogs/test");

            return;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:31,代码来源:LogFileSeperationTests.cs

示例3: GetCommentForum

		private void GetCommentForum(IDnaDataReader reader)
		{
			reader.AddParameter("@uid", _uid)
			.AddParameter("@url", "http://www.bbc.co.uk/comment.shtml")
			.AddParameter("@title", "Comment test")
			.AddParameter("@siteid", 54)
			.AddParameter("@frompostindex", 0)
			.AddParameter("topostindex", 0)
			.AddParameter("@show", 5)
			.AddParameter("@createifnotexists", 1)
			.AddParameter("@duration", 1000)
			.AddParameter("@moderationstatus", 3);
			reader.Execute();
			Assert.IsTrue(reader.Read(), "Checking that getcommentforum returns a row containing the forum details");
		}
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:15,代码来源:PostingSprocTests.cs

示例4: CreateRetrieveTwitterUser

        /// <summary>
        /// This method creates and maps the twitter user to a DNA User ID and retrieve the created twitter user details
        /// </summary>
        /// <param name="searchText"></param>
        /// <param name="dataReader"></param>
        private string CreateRetrieveTwitterUser(string searchText, IDnaDataReader dataReader)
        {
            //TODO: Call the twitter api to get the user details
            TwitterClient client;
            TweetUsers tweetUser;
            //var twitterAPIException = string.Empty;
            var twitterException = string.Empty;
            try
            {
                client = new TwitterClient();
                tweetUser = new TweetUsers();

                //tweetUser = client.GetUserDetails(searchText);
                tweetUser = client.GetUserDetailsByScrapping(searchText);

                // Create the twitter user with the associated dnauserid in DNA
                if (tweetUser != null)
                {
                    ICacheManager cacheManager = CacheFactory.GetCacheManager();

                    var callingUser = new CallingTwitterUser(this.readerCreator, this.dnaDiagnostic, cacheManager);

                    //Create the twitter user and map it to DNA with site id 1
                    callingUser.CreateUserFromTwitterUser(1, tweetUser);
                    callingUser.SynchroniseSiteSuffix(tweetUser.ProfileImageUrl);

                    if (dataReader != null)
                    {
                        dataReader.Execute();
                    }
                }
            }
            catch (Exception ex)
            {
                InputContext.Diagnostics.WriteExceptionToLog(ex);

                var twitterRateLimitException = "Rate limit exceeded.";
                var twitterErrorNotFound = "The remote server returned an error: (404) Not Found.";
                var twitterUnexpectedResponseException = "The remote server returned an unexpected response: (400) Bad Request.";

                if (ex.Message.Contains(twitterRateLimitException))
                {
                    twitterException = "Twitter API has reached its rate limit. Please try again later.";
                }
                else if (ex.Message.Equals(twitterErrorNotFound) ||
                    ex.InnerException.Message.Equals(twitterErrorNotFound))
                {
                    twitterException = "Searched user not found in Twitter";
                }
                else if (ex.Message.Equals(twitterUnexpectedResponseException))
                {
                    twitterException = "Twitter Exception: " + ex.Message + " Please try again in few minutes.";
                }
                else
                {
                    twitterException = "Twitter Exception: " + ex.Message;
                }
            }

            return twitterException;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:66,代码来源:MemberList.cs


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