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


C# DynamicTable.GetQualifiedName方法代码示例

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


在下文中一共展示了DynamicTable.GetQualifiedName方法的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"))
            {
                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

示例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"))
            {
                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

示例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: 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

示例9: 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.Run.FindOne(table.GetQualifiedName(), (SimpleExpression)args[0]);
                return data != null ? new SimpleRecord(data, table.GetQualifiedName(), dataStrategy) : null;
            }

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

示例10: TypeResult

        public static object TypeResult(object result, DynamicTable table, DataStrategy dataStrategy)
        {
            var dictionary = result as IDictionary<string, object>;
            if (dictionary != null) return dictionary.ToDynamicRecord(table.GetQualifiedName(), dataStrategy);

            var list = result as IEnumerable<IDictionary<string, object>>;
            if (list != null) return new SimpleResultSet(list.Select(d => d.ToDynamicRecord(table.GetQualifiedName(), dataStrategy)));

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

示例11: 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

示例12: Execute

        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            if (args.Length != 1) throw new ArgumentException("Incorrect number of arguments to Update method.");
            var keyFieldNames = dataStrategy.Adapter.GetKeyFieldNames(table.GetQualifiedName()).ToArray();
            if (keyFieldNames.Length == 0)
            {
                throw new NotSupportedException("Adapter does not support key-based update for this object.");
            }

            return UpdateByKeyFields(table.GetQualifiedName(), dataStrategy, args[0], keyFieldNames);
        }
开发者ID:ryansroberts,项目名称:Simple.Data,代码行数:11,代码来源:UpdateCommand.cs

示例13: Execute

        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            if (args.Length != 1) throw new ArgumentException("Incorrect number of arguments to Update method.");

            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:paulecoyote,项目名称:Simple.Data,代码行数:11,代码来源:UpdateCommand.cs

示例14: Execute

        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            var result = DoInsert(binder, args, dataStrategy, table.GetQualifiedName());
            
            var dictionary = result as IDictionary<string,object>;
            if (dictionary != null) return dictionary.ToDynamicRecord(table.GetQualifiedName(), dataStrategy);

            var list = result as IEnumerable<IDictionary<string, object>>;
            if (list != null) return list.Select(d => d.ToDynamicRecord(table.GetQualifiedName(), dataStrategy));

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

示例15: 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)
        {
            if (binder.Name.Equals("GetCountBy") || binder.Name.Equals("get_count_by"))
            {
                ArgumentHelper.CheckFindArgs(args, binder);
            }

            var criteriaDictionary = ArgumentHelper.CreateCriteriaDictionary(binder, args, "GetCountBy", "get_count_by");
            var criteria = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(),
                                                                                                  criteriaDictionary);
            return new SimpleQuery(dataStrategy, table.GetQualifiedName()).Where(criteria).Count();
        }
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:20,代码来源:GetCountByCommand.cs


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