Jeff-Lewis / codesmith

Automatically exported from code.google.com/p/codesmith
0 stars 0 forks source link

Add support for data annotation attributes in CSLA 3.8 #156

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Add support for data annotation attributes in CSLA 3.8

    [Serializable]
    public class Data : BusinessBase<Data>
    {
      private static PropertyInfo<int> IdProperty = 
        RegisterProperty<int>(c => c.Id);
      [Range(0, 10, ErrorMessage = "Id must be between 0 and 10")]
      public int Id
      {
        get { return GetProperty(IdProperty); }
        set { SetProperty(IdProperty, value); }
      }

      private static PropertyInfo<string> NameProperty =
        RegisterProperty<string>(c => c.Name);
      [Required(ErrorMessage = "Name is required")]
      public string Name
      {
        get { return GetProperty(NameProperty); }
        set { SetProperty(NameProperty, value); }
      }
    }

http://www.lhotka.net/weblog/LeveragingDataAnnotationAttributesInCSLANET.aspx

Original issue reported on code.google.com by bniemyjski on 6 Oct 2009 at 3:01

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 15 Jan 2010 at 10:47

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 8 Jul 2010 at 10:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
my stomach is in knots right now, we assumed this would happen. any way to get 
this in faster?

Original comment by gyo...@gmail.com on 2 Nov 2011 at 4:37

GoogleCodeExporter commented 9 years ago
Hello,

One could modify the Properties Template that is located in the CSharp or 
VisualBasic Common folder to include these attributes easily. Are you using 
CSLA 3.8 or 4.0?

Original comment by bniemyjski on 3 Nov 2011 at 7:48

GoogleCodeExporter commented 9 years ago
I'm using 4.0, can you give me a hint on what to do? I took a few hours to look 
through but I cannot figure it out yet. Also, let me know where a good forum is 
so I can use that. Thanks for your time!

Original comment by gyo...@gmail.com on 4 Nov 2011 at 8:27

GoogleCodeExporter commented 9 years ago
Hello,

You would need to add code similar to this 
(http://code.google.com/p/codesmith/source/browse/trunk/Templates/Frameworks/PLI
NQO/CSharp/Internal/Entity.Editable.cst Lines 110-150) to this template 
Templates\Frameworks\Csla\CSharp\Common\Properties.cst

It would then generate the attributes when you regenerate.

Original comment by bniemyjski on 7 Nov 2011 at 3:33

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 9 Mar 2012 at 1:18