Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Signum Framework Principles

, 25 Jul 2011
Explains the philosophy behind Signum Framework, an ORM with a full LINQ Provider that encourages an entities-first approach.
SignumFramework_1.0_Setup.zip
SignumFramework_1.0_Src.zip
SignumFramework
Signum.Engine
Connection
DynamicQuery
Engine
Linq
ExpressionVisitor
Properties
resxsync.exe
Schema
Schema.cd
SchemaBuilder
Signum.Engine.csproj.user
Signum.Engine.csproj.vspscc
SignumFramework.pfx
Signum.Entities
Attributes.cd
Basics
Diagram.cd
DynamicQuery
Properties
resxsync.exe
Reflection
Signum.Entities.csproj.user
Signum.Entities.csproj.vspscc
SignumFramework.pfx
Signum.Services
Properties
Signum.Services.csproj.vspscc
SignumFramework.pfx
Signum.Utilities
DataStructures
IntervalDictionaries
ExpressionTrees
Properties
resxsync.exe
Reflection
Signum.Utilities.csproj.user
Signum.Utilities.csproj.vspscc
SignumFramework.pfx
Synchronization
Signum.Windows
Basics
Controls
ColorUtils
DateUtils
Converters
DynamicQuery
Facades
Images
admin.png
cancel.png
close.png
entity.png
find.png
ok.png
open.png
pin.png
reload.png
save.png
star.png
Localization
MarkupExtensions
Properties
resxsync.exe
Signum.Windows.csproj.user
Signum.Windows.csproj.vspscc
SignumFramework.pfx
Themes
SignumFramework.suo
SignumFramework.vssscc
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Globalization;
using System.Windows.Controls;
using Signum.Windows.Properties;

namespace Signum.Windows
{
    public class NullableDecimalConverter : ValidationRule, IValueConverter
    {
        public static readonly NullableDecimalConverter Number = new NullableDecimalConverter() { format = "0.00", numberStyle = NumberStyles.Number };
        public static readonly NullableDecimalConverter Integer = new NullableDecimalConverter() { format = "0", numberStyle = NumberStyles.Integer };
        public static readonly NullableDecimalConverter Currency = new NullableDecimalConverter() { format = "N", numberStyle = NumberStyles.Currency };

        string format;
        NumberStyles numberStyle;

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            decimal? v = (decimal?)value;
            return v == null ? "" : v.Value.ToString(format);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string s = (string)value;
            return s == "" ? null : (decimal?)decimal.Parse(s, numberStyle, CultureInfo.CurrentCulture);
        }

        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            string s = (string)value;
            decimal v;
            if (string.IsNullOrEmpty(s))
                return new ValidationResult(true, null);
            else if (!decimal.TryParse(s, numberStyle, CultureInfo.CurrentCulture, out v))
                return new ValidationResult(false, Resources.InvalidFormat);
            else
                return new ValidationResult(true, null);
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Olmo del Corral
Software Developer (Senior) Signum Software
Spain Spain
I'm Computer Scientist, one of the founders of Signum Software, and the lead developer behind Signum Framework.
 
www.signumframework.com
 
I love programming in C#, Linq, Compilers, Algorithms, Functional Programming, Computer Graphics, Maths...

| Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 26 Jul 2011
Article Copyright 2009 by Olmo del Corral
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid