When declaring such a property in a BusinessBase derived class, it is not possible to resolve the right method signature, because the default value is of the same type as the RelationshipTypes enum.
public static readonly PropertyInfo<Int16> MyInt16Property = RegisterProperty<Int16>(p => p.MyInt16PropName, "friendly name", 1);
If there was something like RelationshipTypes.Default, we could do:
public static readonly PropertyInfo<Int16> MyInt16Property = RegisterProperty<Int16>(p => p.MyInt16PropName, "friendly name", 1, elationshipTypes.Default;
What is the current recommended solution?
I use csla 3.8.x
Sorry for the formatting...
At least in CSLA 4, this code works as expected:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Csla;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var obj = Csla.DataPortal.Create<TestClass>();
Console.WriteLine(obj.Test);
Console.ReadLine();
}
}
[Serializable]
public class TestClass: BusinessBase<TestClass>
{
public static readonly PropertyInfo<Int16> TestProperty = RegisterProperty<Int16>(c => c.Test, "Test", 123);
public Int16 Test
{
get { return GetProperty(TestProperty); }
set { SetProperty(TestProperty, value); }
}
}
}
OK, the issue comes up only for a default value of 0...
But as that is the internal default for numeric types...
it's a no-brainer then.
Thanks!
What I'm saying, is that I ran the code from my previous post, and the value is 123.
Copyright (c) Marimer LLC