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


C# ICommandBuilder类代码示例

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


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

示例1: GetLinks

        private IEnumerable<Gnosis.ILink> GetLinks(ICommandBuilder builder)
        {
            IDbConnection connection = null;
            var links = new List<Gnosis.ILink>();

            try
            {
                connection = GetConnection();

                var command = builder.ToCommand(connection);

                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var link = ReadLink(reader);
                        links.Add(link);
                    }
                }

                return links;
            }
            finally
            {
                if (defaultConnection == null && connection != null)
                    connection.Close();
            }
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:28,代码来源:SQLiteLinkRepository.cs

示例2: GetMedia

        private IEnumerable<IMedia> GetMedia(ICommandBuilder builder)
        {
            IDbConnection connection = null;
            var media = new List<IMedia>();

            try
            {
                connection = GetConnection();

                var command = builder.ToCommand(connection);

                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var medium = ReadMedium(reader);
                        media.Add(medium);
                    }
                }

                return media;
            }
            finally
            {
                if (defaultConnection == null && connection != null)
                    connection.Close();
            }
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:28,代码来源:SQLiteMediaRepository.cs

示例3: ExecuteQuery

 private IEnumerable<IDictionary<string, object>> ExecuteQuery(ICommandBuilder commandBuilder)
 {
     var connection = _connection ?? _adapter.CreateConnection();
     var command = commandBuilder.GetCommand(connection);
     command.Transaction = _transaction;
     return TryExecuteQuery(command);
 }
开发者ID:dezfowler,项目名称:Simple.Data,代码行数:7,代码来源:AdoAdapterFinder.cs

示例4: GetTags

        private IEnumerable<Gnosis.ITag> GetTags(ICommandBuilder builder)
        {
            IDbConnection connection = null;
            var tags = new List<Gnosis.ITag>();

            try
            {
                connection = GetConnection();
                
                var command = builder.ToCommand(connection);

                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var tag = ReadTag(reader);
                        tags.Add(tag);
                    }
                }
                
                return tags;
            }
            finally
            {
                if (defaultConnection == null && connection != null)
                    connection.Close();
            }
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:28,代码来源:SQLiteTagRepository.cs

示例5: ExecuteScalar

		private object ExecuteScalar(ICommandBuilder commandBuilder)
		{
			var connection = _connection ?? _adapter.CreateConnection();
			var command = commandBuilder.GetCommand(connection);
			command.Transaction = _transaction;
			return TryExecuteScalar(command);
		}
开发者ID:vbedegi,项目名称:Simple.Data,代码行数:7,代码来源:AdoAdapterAggregator.cs

示例6: MusicModule

        public MusicModule(IQueryBuilder queryBuilder, ICommandBuilder commandBuilder)
            : base("/music")
        {
            _queryBuilder = queryBuilder;
            _commandBuilder = commandBuilder;

            Get["/"] = _ =>
            {
                this.RequiresAuthentication();
                this.RequiresReadClaim("music");

                var paging = this.BindAndValidate<Paging>();
                var result = _queryBuilder.For<IPagedEnumerable<TrackDto>>().With(paging);

                return Response.AsAccepted(result, new[] { "json", "m3u" }, model => Response.AsJson(model));
            };

            Post["/"] = _ =>
            {
                this.RequiresAuthentication();
                this.RequiresWriteClaim("music");

                var model = this.BindAndValidate<AddTrack>();
                _commandBuilder.Execute(model);

                return new Response
                {
                    StatusCode = HttpStatusCode.Created
                };
            };

            Post["/tagged"] = _ =>
            {
                this.RequiresAuthentication();
                this.RequiresWriteClaim("music");

                var model = this.BindAndValidate<MarkTrackWithTags>();
                _commandBuilder.Execute(model);

                return new Response
                {
                    StatusCode = HttpStatusCode.OK
                };
            };

            Delete["/tagged"] = _ =>
            {
                this.RequiresAuthentication();
                this.RequiresWriteClaim("music");

                var model = this.BindAndValidate<RemoreTagsFromTrack>();
                _commandBuilder.Execute(model);

                return new Response
                {
                    StatusCode = HttpStatusCode.OK
                };
            };
        }
开发者ID:andrewyakonyuk,项目名称:Vault,代码行数:59,代码来源:MusicModule.cs

示例7: CommandInterpreter

 public CommandInterpreter(ICommandBuilder producer, IScene scene, TextReader reader)
     : this(producer, scene)
 {
     if (reader != null)
     {
         Console.SetIn(reader);
     }
 }
开发者ID:Alano13,项目名称:Scene,代码行数:8,代码来源:CommandInterpreter.cs

示例8: AutoUpdaterCommandCreator

 public AutoUpdaterCommandCreator(ICheckTimer checkTimer, IConfigurationConverter configurationConverter, ICommandBuilder commandBuilder,
     INowGetter nowGetter, ILogger logger)
 {
     _checkTimer = checkTimer;
     _configurationConverter = configurationConverter;
     _commandBuilder = commandBuilder;
     _nowGetter = nowGetter;
     _logger = logger;
 }
开发者ID:groma84,项目名称:IwAutoUpdater,代码行数:9,代码来源:AutoUpdaterCommandCreator.cs

示例9: CommandEndpoint

        public CommandEndpoint(ICommandBuilder commandBuilder, Configuration.IProvider configurationProvider)
        {
            _commandBuilder = commandBuilder;
            _settings = configurationProvider.GetSettings();
            _instructionNumber = new InstructionNumber();

            _ipAddress = string.IsNullOrWhiteSpace(_settings.LocalIpAddress)
              ? Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork)
              : IPAddress.Parse(_settings.LocalIpAddress);
        }
开发者ID:jamesleech,项目名称:Harmonize,代码行数:10,代码来源:CommandEndpoint.cs

示例10: AccountModule

        public AccountModule(ICommandBuilder commandBuilder, IQueryBuilder queryBuilder)
            : base("/account")
        {
            _commandBuilder = commandBuilder;
            _queryBuilder = queryBuilder;

            Get["/"] = _ =>
            {
                this.RequiresAuthentication();
                this.RequiresReadClaim("account");

                var paging = this.BindAndValidate<Paging>();
                var result = _queryBuilder.For<IPagedEnumerable<UserDto>>().With(paging);

                return Response.AsJson(result);
            };

            Post["/"] = _ =>
            {
                this.RequiresAuthentication();
                this.RequiresWriteClaim("account");

                var findByEmail = this.BindAndValidate<FindByEmail>();
                var emailAlreadyInUse = _queryBuilder.For<UserDto>().With(findByEmail) != null;
                if (emailAlreadyInUse)
                {
                    return new Response
                    {
                        StatusCode = HttpStatusCode.BadRequest
                    };
                }

                var user = this.BindAndValidate<CreateUser>();
                _commandBuilder.Execute(user);

                return new Response
                {
                    StatusCode = HttpStatusCode.Created
                };
            };

            Post["/{email}"] = _ =>
            {
                this.RequiresAuthentication();
                this.RequiresReadClaim("account");

                var credentials = this.BindAndValidate<Credentials>();
                var result = _queryBuilder.For<UserDto>().With(credentials);

                return Response.AsJson(result);
            };
        }
开发者ID:andrewyakonyuk,项目名称:Vault,代码行数:52,代码来源:AccountModule.cs

示例11: GetJoinClauses

 public IEnumerable<string> GetJoinClauses(IEnumerable<JoinClause> joins, ICommandBuilder commandBuilder)
 {
     var expressionFormatter = new ExpressionFormatter(commandBuilder, _schema);
     foreach (var join in joins)
     {
         var builder = new StringBuilder(JoinKeyword);
         builder.AppendFormat(" JOIN {0}{1} ON ({2})",
             _schema.FindTable(_schema.BuildObjectName(join.Table.ToString())).QualifiedName,
             string.IsNullOrWhiteSpace(join.Table.GetAlias()) ? string.Empty : " " + _schema.QuoteObjectName(join.Table.GetAlias()),
             expressionFormatter.Format(join.JoinExpression));
         yield return builder.ToString().Trim();
     }
 }
开发者ID:kppullin,项目名称:Simple.Data,代码行数:13,代码来源:Joiner.cs

示例12: Filter

 public static void Filter(ref StringBuilder sqlBuilder,string field, ICommandBuilder builder)
 {
     if (OracleKeyWords.Exsit(field))
     {
         sqlBuilder.AppendFormat("{0}{1}{2}"
             , builder.ObjectNamePrefix
             , field
             , builder.ObjectNameSuffix
             );
     }
     else {
         sqlBuilder.Append(field);
     }
 }
开发者ID:swallowcamel,项目名称:ScrewTurn.Wiki.Plugins.Oracle,代码行数:14,代码来源:OracleKeyWordes.cs

示例13: Get_UsingBuilderFactory_ShouldReturnCorrectValue

		public void Get_UsingBuilderFactory_ShouldReturnCorrectValue(
			string name,
			ISchedulers schedulers,
			ICommandBuilder expected)
		{
			//arrange
			var sut = new CommandBuilderProvider(schedulers, (action, schedulers1, arg3) => expected);

			//act
			var actual = sut.Get(name);

			//assert
			actual.Should().Be(expected);
		}
开发者ID:Galad,项目名称:Hanno,代码行数:14,代码来源:CommandBuilderProviderTests.cs

示例14: ExpressionFormatter

 public ExpressionFormatter(ICommandBuilder commandBuilder, DatabaseSchema schema)
 {
     _commandBuilder = commandBuilder;
     _schema = schema;
     _expressionFormatters = new Dictionary<SimpleExpressionType, Func<SimpleExpression, string>>
           {
               {SimpleExpressionType.And, LogicalExpressionToWhereClause},
               {SimpleExpressionType.Or, LogicalExpressionToWhereClause},
               {SimpleExpressionType.Equal, EqualExpressionToWhereClause},
               {SimpleExpressionType.NotEqual, NotEqualExpressionToWhereClause},
               {SimpleExpressionType.GreaterThan, expr => BinaryExpressionToWhereClause(expr, ">")},
               {SimpleExpressionType.GreaterThanOrEqual, expr => BinaryExpressionToWhereClause(expr, ">=")},
               {SimpleExpressionType.LessThan, expr => BinaryExpressionToWhereClause(expr, "<")},
               {SimpleExpressionType.LessThanOrEqual, expr => BinaryExpressionToWhereClause(expr, "<=")},
           };
 }
开发者ID:robashton,项目名称:Simple.Data,代码行数:16,代码来源:ExpressionFormatter.cs

示例15: Execute

 internal int Execute(ICommandBuilder commandBuilder, IAdapterTransaction transaction)
 {
     IDbTransaction dbTransaction = ((AdoAdapterTransaction) transaction).DbTransaction;
     return Execute(commandBuilder, dbTransaction);
 }
开发者ID:loozhang,项目名称:Simple.Data,代码行数:5,代码来源:AdoAdapter.cs


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