ssteenkiste / nettiers

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

Added (prelim) support for DataAnnotations under .net 4.0 #316

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Tested against r837 as I cannot get r839 to compile (see issue 315 )

Adds support for Data Annotations under .net 4.0, for Required Fields, and 
autogenerated fields.

Files changed : 
Entities/EntityBaseCore.generated.cst
Entities/EntityInstanceBase.generated.cst
VisualStudio/vsnet2005.project.cst

Original issue reported on code.google.com by pzycoman@gmail.com on 11 Jun 2010 at 3:12

Attachments:

GoogleCodeExporter commented 9 years ago
An update to the file I posted earlier. One of the references was being called 
in regardless if running on .net 4.0, this has now been fixed.

Original comment by pzycoman@gmail.com on 22 Jun 2010 at 2:25

Attachments:

GoogleCodeExporter commented 9 years ago
Is this the reason I have to reference System.ComponentModel.Annotations in the 
entities project after every regen?

Original comment by james.pa...@gmail.com on 2 Aug 2010 at 1:45

GoogleCodeExporter commented 9 years ago
James, the reference to the project should be automatically pulled in after 
every regen, is this not happening for you?

Original comment by pzycoman@gmail.com on 2 Aug 2010 at 2:02

GoogleCodeExporter commented 9 years ago
That's what I thought should be happening but isn't as of Rev850.

Having just checked out the template it looks like it is being added only for 
NET4 projects however mine is only NET35 and the project refuses to build until 
you add the reference.

I am using EntLib validation if that helps?

Original comment by james.pa...@gmail.com on 2 Aug 2010 at 2:21

GoogleCodeExporter commented 9 years ago
James - theres definatly something I have missed then - i'll take a look 
sometime today (I cant right now, but I promise I will look at it today), if 
thats ok?

Original comment by pzycoman@gmail.com on 2 Aug 2010 at 2:27

GoogleCodeExporter commented 9 years ago
That would be great.  Don't bust a gut though.  It's not holding me up at the 
moment.

Original comment by james.pa...@gmail.com on 2 Aug 2010 at 2:38

GoogleCodeExporter commented 9 years ago
Another thought....  The DLL was introduced in .NET 3.5 SP1 so is probably not 
a NET4 only feature.

Original comment by james.pa...@gmail.com on 2 Aug 2010 at 2:44

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 2 Aug 2010 at 9:11

GoogleCodeExporter commented 9 years ago
James, just an update for you - I think I have forgot a condition check in 
EntityBaseCore.generated.cst, ill do some further testing tommorrow, and 
hopefully have a patch for you.

Yeah im aware that the DLL was introduced in 3.5 sp1, but the options you can 
pick for nettiers generation is either 3.5 or 4 - to be safe, I put it under 4, 
if that makes sense?

Original comment by pzycoman@gmail.com on 2 Aug 2010 at 9:47

GoogleCodeExporter commented 9 years ago
James,

Havnt completely forgotten about you - heres the latest combined patch tested 
against r850 which seems to have fixed the issue - do let me know how you get 
on with it please.

Thanks

Original comment by pzycoman@gmail.com on 11 Aug 2010 at 9:30

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

Applied patch although it hasn't solved my issue.  My generated code contains 
data annotations probably because I am using EntLib validation.

[StringLengthValidator(5, MessageTemplate="Maximum length has been exceeded.", 
Tag="PrimaryDxccPrefix")]

Therefore using a 3.5 project I require the reference to 
System.ComponentModel.Annotations when using entlib validation.

I've patched and attached my fix.  Together we will crack this. :-)

James.

Original comment by james.pa...@gmail.com on 12 Aug 2010 at 10:17

Attachments:

GoogleCodeExporter commented 9 years ago
Issue316-r850-1-jp.patch is still required when targeting entlib5 and NET4.  
Can this please be merged into the core to ensure first time users don't have 
this problem.

Original comment by james.pa...@gmail.com on 6 Dec 2010 at 9:42

GoogleCodeExporter commented 9 years ago
Hello,

These patches have been committed in revision 861. I refined the EntLib check 
as the the System.ComponentModel.Annotations assembly only existed in v3.5 and 
v4.0.

<% if (GetDotNetFrameworkString( DotNetVersion ) == "4.0" || (ValidationType == 
MoM.Templates.ValidationType.EntLib && GetDotNetFrameworkString( DotNetVersion 
) == "3.5")) {%>
    <Reference Include="System.ComponentModel.DataAnnotations"/>
<%}%>

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 9 Dec 2010 at 12:15

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 7 Jan 2011 at 2:44