コード例 #1
0
        /// <summary>
        /// Get cmd parameters
        /// </summary>
        /// <returns></returns>
        public CommandParameters GetCommandParameters()
        {
            var parameters   = new CommandParameters();
            var entityConfig = EntityManager.GetEntityConfiguration(entityType);

            if (entityConfig == null)
            {
                return(parameters);
            }
            foreach (var fieldItem in entityConfig.AllFields)
            {
                var value  = GetValue(fieldItem.Key);
                var dbType = LookupDbType(fieldItem.Value.DataType, fieldItem.Key, false, out ITypeHandler handler);
                parameters.Add(fieldItem.Key, value, dbType: dbType);
            }
            return(parameters);
        }
コード例 #2
0
        /// <summary>
        /// Gets all property or field values
        /// </summary>
        /// <returns>Return all property values</returns>
        public Dictionary <string, dynamic> GetAllValues()
        {
            var entityConfig = EntityManager.GetEntityConfiguration(entityType);

            if (entityConfig == null)
            {
                throw new EZNEWException($"Get {entityType.FullName}'s configuration is null");
            }
            var allValues = new Dictionary <string, dynamic>(entityConfig.AllFields.Count);

            foreach (var field in entityConfig.AllFields)
            {
                if (field.Value?.ValueProvider == null)
                {
                    throw new EZNEWException($"{entityType.FullName} => {field.Key}'s value provider is null");
                }
                allValues[field.Key] = field.Value.ValueProvider.Get(this);
            }
            return(allValues);
        }