[Mono-list] How to fix System.Data.Linq.Mapping.ColumnAttribute.CanBeNull default value False

Andrus kobruleht2 at hot.ee
Fri Mar 5 03:19:27 EST 2010


In MONO 2.4 and 2.6.1 code below outputs

canbenull==False

How to fix ?

Andrus.


using System;
using System.Data.Linq.Mapping;
using System.Reflection;

public class Kontekst
{
    [Column()]
    public DateTime? Akuupaev { get; set; }
}

class Program
{
    static void Main()
    {
        const BindingFlags FLAGS = BindingFlags.Instance | 
BindingFlags.Public | BindingFlags.NonPublic;
        const MemberTypes PROP_FIELD = MemberTypes.Property | 
MemberTypes.Field;
        Type type = typeof(Kontekst);
        foreach (MemberInfo member in type.GetMembers(FLAGS))
        {
            if ((member.MemberType & PROP_FIELD) == 0) continue;
            ColumnAttribute col = Attribute.GetCustomAttribute(member, 
typeof(ColumnAttribute)) as ColumnAttribute;
            if (col == null) continue;
            Console.WriteLine("canbenull=={0}", col.CanBeNull);
        }
        Console.ReadLine();
}} 



More information about the Mono-list mailing list