MetadataDefaultsProvider Class

Overview

The MetadataDefaultsProvider class is the concrete implementation of IDataTypeDefaultValueProvider in the PocoDataSet.Data assembly. It provides a dependency-injection-friendly entry point for resolving default values for newly created cells based on a column's logical data type and nullability.

Internally, MetadataDefaultsProvider delegates all default-value decisions to the static MetadataDefaults helper. This keeps defaulting rules centralized while allowing higher-level components (factories, UI frameworks, adapters) to depend on an interface rather than calling static methods directly.

Namespace and Assembly

Namespace: PocoDataSet.Data
Assembly: PocoDataSet.Data.dll

Declaration

public class MetadataDefaultsProvider : IDataTypeDefaultValueProvider
{
    public object? GetDefaultValue(string? dataType, bool isNullable)
    {
        return MetadataDefaults.GetDefaultValue(dataType, isNullable);
    }
}

Method Notes

Usage Example

// Example: resolving a default value from column metadata
IDataTypeDefaultValueProvider provider = new MetadataDefaultsProvider();

// Suppose the column is an INT32 and not nullable
object? defaultValue = provider.GetDefaultValue(DataTypeNames.INT32, false);

// defaultValue can now be assigned to a newly created cell
// (exact value depends on MetadataDefaults rules)

Design Notes

Use MetadataDefaults directly when a static call is sufficient (for example, in simple extension methods). Use MetadataDefaultsProvider when you want an interface boundary for dependency injection, unit testing, or alternative strategies.

 

Table of Content POCO DataSet PocoDataSet.Data

 


Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness or suitability of the information and are not responsible for any damages resulting from its use.