Parameterless constructor

Posts   
 
    
simon831
User
Posts: 152
Joined: 19-Jan-2006
# Posted on: 24-Sep-2007 23:30:39   

I have created a custom factory. It has one constructor:


        public MyDetailEntityFactory(object myobject)
        {
            .......
        }

Everything works fine until I try to pass an entitycollection back to a windows app via a webservice and I get:

No parameterless constructor defined for this object.

I can't figure out what bit of code is trying to use a default constructor or why.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 25-Sep-2007 06:38:18   

Could you please post a complete StackTrace? Also, what LLBLGenPro version and runtime version are you using? (http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=7717)

David Elizondo | LLBLGen Support Team
simon831
User
Posts: 152
Joined: 19-Jan-2006
# Posted on: 25-Sep-2007 10:08:15   

Using v2.5 28th Aug.

INNER EXCEPTION: {"No parameterless constructor defined for this object."} System.Exception {System.MissingMethodException}

StackTrace " at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)\r\n at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)\r\n at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)\r\n at System.Activator.CreateInstance(Type type, Boolean nonPublic)\r\n at System.Activator.CreateInstance(Type type)\r\n at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase21.Xml2EntityCollection(XmlReader reader, Dictionary2 processedObjectIDs, List1 nodeEntityReferences)\r\n at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase21.ReadXml(XmlReader reader, XmlFormatAspect format)\r\n at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2`1.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader reader)\r\n at System.Xml.Serialization.XmlSerializationReader.ReadSerializable(IXmlSerializable serializable)\r\n at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPrintstation.Read2_Item()\r\n at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer1.Deserialize(XmlSerializationReader reader)\r\n at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)" string

EXCEPTION: Message "There is an error in XML document (1, 319)." string StackTrace " at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)\r\n at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)\r\n at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)\r\n at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)\r\n at Eprint.Skyline.PrintStation.SkylineService.Printstation.GetOrdersByPrintstation(Guid psid, Int32 count, Boolean assigned, Boolean unassigned) in D:\TeamSystemProjects\Skyline\Skyline\PrintStation\Web References\SkylineService\Reference.cs:line 196\r\n at Eprint.Skyline.PrintStation.Splash.loginButton_Click(Object sender, EventArgs e) in D:\\TeamSystemProjects\\Skyline\\Skyline\\PrintStation\\Splash.cs:line 28\r\n at System.Windows.Forms.Control.OnClick(EventArgs e)\r\n at System.Windows.Forms.Button.OnClick(EventArgs e)\r\n at System.Windows.Forms.Button.PerformClick()\r\n at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData)\r\n at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)\r\n at System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData)\r\n at System.Windows.Forms.Control.PreProcessMessage(Message& msg)\r\n at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)\r\n at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)\r\n at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.I MsoComponent.FPreTranslateMessage(MSG& msg)\r\n at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms. UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.Run()\r\n at Eprint.Skyline.PrintStation.Classes.Program.Main() in D:\\TeamSystemProjects\\Skyline\\Skyline\\PrintStation\\Classes\\Program.cs:line 61" string

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 25-Sep-2007 11:28:14   

I have created a custom factory. It has one constructor: Code:

    public MyDetailEntityFactory(object myobject)
    {
        .......
    }

Everything works fine until I try to pass an entitycollection back to a windows app via a webservice and I get:

Does the windows application have a reference to the new custom factory? As the webservice serializes the entities, the windows application will need the custom entity factory to deserialize the entities.

simon831
User
Posts: 152
Joined: 19-Jan-2006
# Posted on: 19-Nov-2007 00:08:09   

Walaa wrote:

Does the windows application have a reference to the new custom factory? As the webservice serializes the entities, the windows application will need the custom entity factory to deserialize the entities.

The custom factory is in a project that is referenced by the windows application. I assume the entity 'knows' which factory was used to serialise itself, or do you have to set something?

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 19-Nov-2007 09:35:24   

Would you please post the factory code and the code used to create the objects? The XML produced is apparently not parsable, that's why we need you to provide more code.

simon831
User
Posts: 152
Joined: 19-Jan-2006
# Posted on: 19-Nov-2007 11:08:26   

Walaa wrote:

Would you please post the factory code ...

I have put it here as I didn't want to post this code on the public forums http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=11905