Generated proxy

Posts   
 
    
hchattaway
User
Posts: 38
Joined: 06-Apr-2006
# Posted on: 16-Jun-2010 05:03:20   

Hi all,

Been using v3 and it has saved a ton of time! One question though on one of the WCF examples...

I am using this code block from the WCF provided example and changing CustomersEntity to be for the table in my project...

 public IEntityCollection2 GetAllCustomers()
        {
            EntityCollection toReturn = new EntityCollection( new CustomersEntityFactory());
            using (DataAccessAdapter adapter = new DataAccessAdapter())
            {
                // simply fetch all customer entities into the collection.
                adapter.FetchEntityCollection(toReturn, null);
            }
            return toReturn;
        }

I create the proxy in VS 2010, and it generated this section:


 public partial class EntityCollection : object, System.ComponentModel.INotifyPropertyChanged {
        
        private schema schemaField;
        
        private System.Xml.XmlElement anyField;
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Namespace="http://www.w3.org/2001/XMLSchema", Order=0)]
        public schema schema {
            get {
                return this.schemaField;
            }
            set {
                this.schemaField = value;
                this.RaisePropertyChanged("schema");
            }
        }
        

The "schema" types are not working.. saying it can't resolved this.. I have done a lot of searching, and this has been happening on Silverlight apps and to include the System.XML.Serialization assembly. In .NET 4.0, it does not seem to be there however.

Is there a way around this?

Thanks Harold

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Jun-2010 07:01:55   

Did you have this working on v2.6 and it's break in v3.0? How does your data contract looks like? What is the complete error message you received when compiling/running?

David Elizondo | LLBLGen Support Team
hchattaway
User
Posts: 38
Joined: 06-Apr-2006
# Posted on: 16-Jun-2010 13:49:20   

daelmo wrote:

Did you have this working on v2.6 and it's break in v3.0? How does your data contract looks like? What is the complete error message you received when compiling/running?

This was something new I just did in 3.0

The error message is: "Error 1 The type or namespace name 'schema' could not be found (are you missing a using directive or an assembly reference?) "

I don't see any [DataContract] attributes on the generated code by LLBLGen.

But in this code:



    public partial class IssueEntity : CommonEntityBase
        // __LLBLGENPRO_USER_CODE_REGION_START AdditionalInterfaces
        // __LLBLGENPRO_USER_CODE_REGION_END    


the "ISerializable" interface is not used here, but in the WCF example from the LLBLGen site, it is provided:


[Serializable]
    public partial class CustomersEntity : CommonEntityBase, ISerializable
        // __LLBLGENPRO_USER_CODE_REGION_START AdditionalInterfaces
        // __LLBLGENPRO_USER_CODE_REGION_END    

Any other settings needed for code generation?

Thanks Harold

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 16-Jun-2010 14:28:22   

[DataContract] and other attributes attributes can be added through the project properties -> Code gen. meta-data defaults -> Attributes per element type (in the last tab of the project properties).

These are then inherited by every instance of that type, i.e. every entity or every field and can be overriden in their own editor as stated in the documentation.