Class DbTypeDecoratorExtensions
Extension methods for the DbType enumeration hidden behind the IDecorator<T> interface.
public static class DbTypeDecoratorExtensions
- Inheritance
-
DbTypeDecoratorExtensions
Examples
The following example demonstrates how to use the ToType extension method to resolve the equivalent System.Type for a DbType value.
using System;
using System.Data;
using Cuemon;
using Cuemon.Data;
namespace MyApp.Examples;
public class DbTypeDecoratorExtensionsExample
{
public static void Main()
{
DbType[] types = { DbType.Int32, DbType.String, DbType.DateTime, DbType.Boolean };
foreach (var dbType in types)
{
Type clrType = Decorator.Enclose(dbType).ToType();
Console.WriteLine("DbType.{0} -> {1}", dbType, clrType);
// Output:
// DbType.Int32 -> System.Int32
// DbType.String -> System.String
// DbType.DateTime -> System.DateTime
// DbType.Boolean -> System.Boolean
}}
}
Methods
ToType(IDecorator<DbType>)
public static Type ToType(this IDecorator<DbType> decorator)
Parameters
decoratorIDecorator<DbType>The IDecorator<T> to extend.
Returns
Exceptions
- ArgumentNullException
decoratoris null or its underlying value is null.- ArgumentOutOfRangeException
decoratorunderlying value is not valid.
See Also
IDecorator<T>
Decorator<T>