yasser777 / nettiers

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

Assembly is not marked as serializable #153

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run .netTiers templates against SQL server 2005 database with the
IncludeWCFDataAttributes = True.
2. Run the admin website.
3. trying to display the EntityName.aspx page results in the error

 Type 'SomeNamespace.Web.Data.ProviderDataSourceDeepLoadList' in Assembly
'SomeNamespace.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
is not marked as serializable.

What is the expected output? What do you see instead?
I expected to see the datarows for my entity table

What version of .netTiers and CodeSmith are you using?
v2.3.0.b2 Codesmith 5.0

Please provide any additional information below.

Fix is to set IncludeWCFDataAttributes = False and regenerate the code.

Original issue reported on code.google.com by gmd...@gmail.com on 7 Jan 2009 at 10:56

GoogleCodeExporter commented 9 years ago
The actual fix is to modify the EntityInstanceBase.generated.cst file by 
changing 
the following:

<% if ( IncludeWCFDataAttributes ) { %>
    [DataContract]
    <% } else { %>
    [Serializable]
    <% } %>

to

<% if ( IncludeWCFDataAttributes ) { %>
    [DataContract, Serializable]
    <% } else { %>
    [Serializable]
    <% } %>

How does one get access to make coding modifications, I can implement this 
change.

Original comment by vi...@daviworld.net on 22 Jan 2009 at 4:26

GoogleCodeExporter commented 9 years ago
Serializable attribute was applied like you show above until Rev 757.  The fix 
you
propose seems appropriate.  Would like to confirm that this was an unintended 
side
effect.

This issue is related to Rev 757
http://code.google.com/p/nettiers/issues/detail?id=87

Original comment by rhet...@gmail.com on 23 Jan 2009 at 6:25

GoogleCodeExporter commented 9 years ago
Also needs to make the similar change in EntityData template.  After that the 
sample
app seems to be working without issue.  Generated using Northwind.

Original comment by rhet...@gmail.com on 23 Jan 2009 at 6:50

GoogleCodeExporter commented 9 years ago
Patch

Original comment by rhet...@gmail.com on 23 Jan 2009 at 7:06

Attachments:

GoogleCodeExporter commented 9 years ago
I had an application that tested this.  Making this change worries me a little. 

Please fully test entity serialization in order to see if this works.  You 
shouldn't 
have to mark things serializable when using WCF.

Is the Admin Website running through the Web Services maybe.  You shouldn't be 
able 
to use the WebServices with the DataContract attributes.

I don't know, the DataContract attributes were in bad shape when I fixed them.  
I 
will see if I still have all my tests I ran when I coded this.

jeff

Original comment by jmhin...@gmail.com on 23 Jan 2009 at 1:32

GoogleCodeExporter commented 9 years ago
I see now that the DataContract should be an acceptable substitute for the
serializable attribute.  Maybe the issue is with the way the admin site is 
setup. I'm
working on getting a sample running that uses the web services project...

Original comment by rhet...@gmail.com on 24 Jan 2009 at 2:09

GoogleCodeExporter commented 9 years ago

Original comment by rhet...@gmail.com on 3 Feb 2009 at 5:45

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 25 May 2009 at 3:30

GoogleCodeExporter commented 9 years ago
What is the status of this bug?

Original comment by bniemyjski on 25 May 2009 at 4:20

GoogleCodeExporter commented 9 years ago
Although the DataContract attribute is appropriate for WCF it is not 
appropriate 
when serializing elsewhere.  Serialization is done directly when making a deep 
copy 
of the object, specifically in the EntityHelper Clone<T> method.  The classes 
mentioned should be marked as serializable for the DeepCopy to work.  This 
creates 
an issue anywhere deepcopy is used.

As far as I can tell the suggested changes resolve the issue.

Original comment by jbai...@baileysc.com on 19 Aug 2009 at 2:12

GoogleCodeExporter commented 9 years ago
On the latest version of code that is downloadable from main google code page, 
this
error still exists.

Original comment by depictur...@gmail.com on 30 Sep 2009 at 2:02

GoogleCodeExporter commented 9 years ago
Revision 821 does not include this patch and the exception 
Type 'SomeNamespace.Web.Data.ProviderDataSourceDeepLoadList' in Assembly
'SomeNamespace.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
is not marked as serializable.

still occurs in the website admin pages as described above when selecting 
IncludeWCFDataAttributes. 

Original comment by peterrie...@bluewin.ch on 2 Dec 2009 at 10:51

GoogleCodeExporter commented 9 years ago
The current featured download still has this issue when 
IncludeWCFDataAttributes is set to true.

Original comment by matrobic...@gmail.com on 17 Feb 2011 at 9:02

GoogleCodeExporter commented 9 years ago
Xkubr, could you please take a look into this.

Thanks
-Blake

Original comment by bniemyjski on 4 Mar 2011 at 8:05