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


C# DynamicTable类代码示例

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


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

示例1: CreateDelegate

        public Func<object[], object> CreateDelegate(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            if (dataStrategy is SimpleTransaction) return null;

            if (binder.Name.Equals("FindBy") || binder.Name.Equals("find_by"))
            {
                if (args.Length == 0) throw new ArgumentException("FindBy requires arguments.");
                if (args.Length == 1)
                {
                    if (ReferenceEquals(args[0], null)) throw new ArgumentException("FindBy does not accept unnamed null argument.");
                    if (args[0].GetType().Namespace == null) return null;
                }
            }

            var criteriaDictionary = CreateCriteriaDictionary(binder, args);
            if (criteriaDictionary == null) return null;

            var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), criteriaDictionary);
            try
            {
                var adapter = dataStrategy.GetAdapter();
                var func = adapter.OptimizingDelegateFactory.CreateFindOneDelegate(adapter, table.GetQualifiedName(), criteriaExpression);
                return a =>
                           {
                               var data = func(a);
                               return (data != null && data.Count > 0)
                                          ? new SimpleRecord(data, table.GetQualifiedName(), dataStrategy)
                                          : null;
                           };
            }
            catch (NotImplementedException)
            {
                return null;
            }
        }
开发者ID:kotsaris,项目名称:Simple.Data,代码行数:35,代码来源:FindByCommand.cs

示例2: Execute

 public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
 {
     var criteria = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), MethodNameParser.ParseFromBinder(binder, args));
     return new SimpleQuery(dataStrategy.Adapter, table.GetQualifiedName()).Where(criteria);
     //var data = dataStrategy.Find(table.GetQualifiedName(), criteria);
     //return CreateSimpleResultSet(table, dataStrategy, data);
 }
开发者ID:osaylan1,项目名称:Simple.Data,代码行数:7,代码来源:FindAllByCommand.cs

示例3: CreateDelegate

        public Func<object[], object> CreateDelegate(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            if (dataStrategy is SimpleTransaction) return null;

            if (binder.Name.Equals("FindBy") || binder.Name.Equals("find_by"))
            {
                ArgumentHelper.CheckFindArgs(args, binder);
                if (args.Length == 1 && args[0].IsAnonymous()) return null;
            }

            var criteriaDictionary = ArgumentHelper.CreateCriteriaDictionary(binder, args, "FindBy", "find_by");
            if (criteriaDictionary == null) return null;

            var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), criteriaDictionary);
            try
            {
                var adapter = dataStrategy.GetAdapter();
                var func = adapter.OptimizingDelegateFactory.CreateFindOneDelegate(adapter, table.GetQualifiedName(), criteriaExpression);
                return a =>
                           {
                               var data = func(a);
                               return (data != null && data.Count > 0)
                                          ? new SimpleRecord(data, table.GetQualifiedName(), dataStrategy)
                                          : null;
                           };
            }
            catch (NotImplementedException)
            {
                return null;
            }
        }
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:31,代码来源:FindByCommand.cs

示例4: CreateDelegate

        public Func<object[], object> CreateDelegate(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            if (dataStrategy is SimpleTransaction) return null;

            var criteriaDictionary = CreateCriteriaDictionary(binder, args);
            if (criteriaDictionary == null) return null;

            var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), criteriaDictionary);
            try
            {
                var adapter = dataStrategy.GetAdapter();
                var func = adapter.OptimizingDelegateFactory.CreateFindOneDelegate(adapter, table.GetQualifiedName(), criteriaExpression);
                return a =>
                           {
                               var data = func(a);
                               return (data != null && data.Count > 0)
                                          ? new SimpleRecord(data, table.GetQualifiedName(), dataStrategy)
                                          : null;
                           };
            }
            catch (NotImplementedException)
            {
                return null;
            }
        }
开发者ID:hlach,项目名称:Simple.Data,代码行数:25,代码来源:FindByCommand.cs

示例5: Execute

 public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
 {
     var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(),
                                                                              CreateCriteriaDictionary(binder,
                                                                                                       args));
     var data = dataStrategy.Run.FindOne(table.GetQualifiedName(), criteriaExpression);
     return data != null ? new SimpleRecord(data, table.GetQualifiedName(), dataStrategy) : null;
 }
开发者ID:kotsaris,项目名称:Simple.Data,代码行数:8,代码来源:FindByCommand.cs

示例6: Execute

 public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
 {
     var criteria = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), MethodNameParser.ParseFromBinder(binder, args));
     var data = dataStrategy.Find(table.GetQualifiedName(), criteria);
     return new SimpleResultSet(data != null
                  ? data.Select(dict => new SimpleRecord(dict, table.GetQualifiedName(), dataStrategy))
                  : Enumerable.Empty<SimpleRecord>());
 }
开发者ID:Ang3lFir3,项目名称:Simple.Data,代码行数:8,代码来源:FindAllByCommand.cs

示例7: Execute

        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="dataStrategy">The data strategy.</param>
        /// <param name="table"></param>
        /// <param name="binder">The binder from the <see cref="DynamicTable"/> method invocation.</param>
        /// <param name="args">The arguments from the <see cref="DynamicTable"/> method invocation.</param>
        /// <returns></returns>
        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            var criteriaDictionary = ArgumentHelper.CreateCriteriaDictionary(binder, args, "ExistsBy", "exists_by", "AnyBy", "any_by");
            if (criteriaDictionary == null) return null;

            var criteria  = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), criteriaDictionary);
            return new SimpleQuery(dataStrategy, table.GetQualifiedName()).Where(criteria).Exists();
        }
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:16,代码来源:ExistsByCommand.cs

示例8: Execute

 public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
 {
     var result = dataStrategy.Run.Get(table.GetName(), args);
     if (result == null || result.Count == 0) return null;
     return binder.Name.Equals("get", StringComparison.OrdinalIgnoreCase)
                ? new SimpleRecord(result, table.GetQualifiedName(), dataStrategy)
                : result.First().Value;
 }
开发者ID:kotsaris,项目名称:Simple.Data,代码行数:8,代码来源:GetCommand.cs

示例9: loadData

 protected override void loadData()
 {
     var table = new DynamicTable( new EwfTableColumn( "Email", Unit.Percentage( 50 ) ), new EwfTableColumn( "Role", Unit.Percentage( 50 ) ) );
     table.AddActionLink( new ActionButtonSetup( "Create User", new EwfLink( new EditUser.Info( es.info, null ) ) ) );
     foreach( var user in UserManagementStatics.GetUsers() )
         table.AddTextRow( new RowSetup { ClickScript = ClickScript.CreateRedirectScript( new EditUser.Info( es.info, user.UserId ) ) }, user.Email, user.Role.Name );
     ph.AddControlsReturnThis( table );
 }
开发者ID:william-gross,项目名称:enterprise-web-library,代码行数:8,代码来源:SystemUsers.aspx.cs

示例10: Execute

        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="dataStrategy">The database or transaction</param>
        /// <param name="table"></param>
        /// <param name="binder">The binder from the <see cref="DynamicTable"/> method invocation.</param>
        /// <param name="args">The arguments from the <see cref="DynamicTable"/> method invocation.</param>
        /// <returns></returns>
        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            if (args.Length == 1 && args[0] is SimpleExpression)
            {
                return new SimpleQuery(dataStrategy, table.GetQualifiedName()).Where((SimpleExpression)args[0]);
            }

            throw new BadExpressionException("FindAll only accepts a criteria expression.");
        }
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:17,代码来源:FindAllCommand.cs

示例11: UpdateUsingKeys

        private static object UpdateUsingKeys(DataStrategy dataStrategy, DynamicTable table, object[] args)
        {
            var record = ObjectToDictionary(args[0]);
            var list = record as IList<IDictionary<string, object>>;
            if (list != null) return dataStrategy.UpdateMany(table.GetQualifiedName(), list);

            var dict = record as IDictionary<string, object>;
            return dataStrategy.Update(table.GetQualifiedName(), dict);
        }
开发者ID:reverentgeek,项目名称:Simple.Data,代码行数:9,代码来源:UpdateCommand.cs

示例12: GetCriteriaExpression

        private static SimpleExpression GetCriteriaExpression(InvokeMemberBinder binder, object[] args, DynamicTable table)
        {
            var criteria = binder.Name.Equals("delete", StringComparison.InvariantCultureIgnoreCase) ?
                                                                                                         binder.NamedArgumentsToDictionary(args)
                               :
                                   MethodNameParser.ParseFromBinder(binder, args);

            return ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), criteria);
        }
开发者ID:reverentgeek,项目名称:Simple.Data,代码行数:9,代码来源:DeleteByCommand.cs

示例13: Execute

        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="dataStrategy">The database or transaction</param>
        /// <param name="table"></param>
        /// <param name="binder">The binder from the <see cref="DynamicTable"/> method invocation.</param>
        /// <param name="args">The arguments from the <see cref="DynamicTable"/> method invocation.</param>
        /// <returns></returns>
        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            if (args.Length == 1 && args[0] is SimpleExpression)
            {
                return new SimpleQuery(dataStrategy, table.GetQualifiedName()).Where((SimpleExpression)args[0]);
            }

            return null;
        }
开发者ID:rposbo,项目名称:Simple.Data,代码行数:17,代码来源:FindAllCommand.cs

示例14: Find_Each_Accepts_Action_Argument

        public void Find_Each_Accepts_Action_Argument()
        {
            var table = new DynamicTable("Users");

            var result = table.FindEach(x =>
            {

            });
        }
开发者ID:meadiagenic,项目名称:DynamicData,代码行数:9,代码来源:SyntaxTests.cs

示例15: Execute

        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="dataStrategy">The database (or transaction)</param>
        /// <param name="table"></param>
        /// <param name="binder">The binder from the <see cref="DynamicTable"/> method invocation.</param>
        /// <param name="args">The arguments from the <see cref="DynamicTable"/> method invocation.</param>
        /// <returns></returns>
        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            if (args.Length == 1 && args[0] is SimpleExpression)
            {
                var data = dataStrategy.FindOne(table.GetQualifiedName(), (SimpleExpression)args[0]);
                return data != null ? new SimpleRecord(data, table.GetQualifiedName(), dataStrategy) : null;
            }

            return null;
        }
开发者ID:reverentgeek,项目名称:Simple.Data,代码行数:18,代码来源:FindCommand.cs


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