Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Derived Model field attributes
 

Pages: 1
LLBLGen Pro Runtime Framework
Derived Model field attributes
Page:1/1 

  Print all messages in this thread  
Poster Message
jovball
User



Location:
USA
Joined on:
23-Jan-2005 19:53:47
Posted:
393 posts
# Posted on: 29-Apr-2016 20:24:37.  
I am trying to get some experience with v5, especially looking at the new feature for derived models. I created a simple derived model based on Northwind Order and added some addition denormalized fields for Customer.

I am having two issues. One seems like a bug and the other is a design question.

I was expecting that the code generation would add attributes to the fields for things like Required, StringLength, and perhaps DataType. However, it doesn't do that.

Here's what I get
Code:

    /// <summary>Gets or sets the OrderDate field. Derived from Entity Model Field 'Order.OrderDate'</summary>
        [DataMember]
    public Nullable<System.DateTime> OrderDate { get; set; }

        /// <summary>Gets or sets the Freight field. Derived from Entity Model Field 'Order.Freight'</summary>
        [DataMember]
        public Nullable<System.Decimal> Freight { get; set; }

        /// <summary>Gets or sets the CustomerCompanyName field. Derived from Entity Model Field 'Customer.CompanyName (Customer)'</summary>
        [DataMember]
        public System.String CustomerCompanyName { get; set; }



Here's what I want.

Code:

        /// <summary>Gets or sets the OrderDate field. Derived from Entity Model Field 'Order.OrderDate'</summary>
        [DataMember]
        [DataType(DataType.DateTime)]
    public Nullable<System.DateTime> OrderDate { get; set; }

        /// <summary>Gets or sets the Freight field. Derived from Entity Model Field 'Order.Freight'</summary>
        [DataMember]
        public Nullable<System.Decimal> Freight { get; set; }

        /// <summary>Gets or sets the CustomerCompanyName field. Derived from Entity Model Field 'Customer.CompanyName (Customer)'</summary>
        [DataMember]
        [Required]
        [StringLength(40)]
        public System.String CustomerCompanyName { get; set; }


I added some attributes in the designer and generated the code. That works but it's a lot of work in the designer that I think the tool should do for me. Dissapointed

Also, when I close the project, it does not save the attributes that I put into the designer. Angry I would hope that this is a bug.
Joel Reinford
LLBLGenPro Version: 5.5.3
Templates: Adapter
Framework: .Net 4.6
Database: SQL Server 2012/2014, DB2 v10
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37884 posts
# Posted on: 29-Apr-2016 21:43:52.  
WHere exactly did you add the attributes? If you want them to be project wide, you have to define them in the right derived model in project settings, below the model -> attributes.

So attributes defined on the entity field which is used in a derived model aren't inherited, you have to define them in the project settings and then the attribute section of the derived model in question, if you want them to be defined at the project level.

You can indeed also define them at the element level, in the derived element editor.

Please describe where exactly you did define the attributes so we can have a look Regular Smiley


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
jovball
User



Location:
USA
Joined on:
23-Jan-2005 19:53:47
Posted:
393 posts
# Posted on: 29-Apr-2016 21:59:43. Goto attachments  
I'm adding them in the derived element editor. See screenshot.

Is there a way to specify at the project level that all non-nullable fields should have the [Required] attribute?
Joel Reinford
LLBLGenPro Version: 5.5.3
Templates: Adapter
Framework: .Net 4.6
Database: SQL Server 2012/2014, DB2 v10
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37884 posts
# Posted on: 29-Apr-2016 22:20:25.  
jovball wrote:
I'm adding them in the derived element editor. See screenshot.

Ok. I can reproduce them not being saved.

Quote:

Is there a way to specify at the project level that all non-nullable fields should have the [Required] attribute?

Yes, go to project settings, scroll down in the tree left to your derived model, then below that under 'Code Generation' you see 'Attributes'. Click it. At the right, you can now select 'Derived Element Field Scalar' as element type.

Then type as attribute 'Required' and click the '...' button for the rule, then click [+] in the popup, select 'Source field is optional' and 'is true', click OK, and tab to make the attribute row permanent. Click OK to close project settings. all derived element fields which are optional now have that attribute.

We'll look into the attribute not being saved when added at the element level!


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
jovball
User



Location:
USA
Joined on:
23-Jan-2005 19:53:47
Posted:
393 posts
# Posted on: 29-Apr-2016 23:07:38.  
I got the Required attribute working, thanks for that.

Also, I'm looking at https://www.llblgen.com/documentation/5.0/Designer/Functionality%20Reference/ElementDefinitionMacros.htm for the rest of what I wanted. That might take care of it, I'll know soon.
Joel Reinford
LLBLGenPro Version: 5.5.3
Templates: Adapter
Framework: .Net 4.6
Database: SQL Server 2012/2014, DB2 v10
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37884 posts
# Posted on: 29-Apr-2016 23:15:40.  
jovball wrote:
I got the Required attribute working, thanks for that.

Regular Smiley The issue you reported about the individual element attributes not being saved is a bug we'll fix.

Quote:

Also, I'm looking at https://www.llblgen.com/documentation/5.0/Designer/Functionality%20Reference/ElementDefinitionMacros.htm for the rest of what I wanted. That might take care of it, I'll know soon.

Yes the macros are helpful here as they can be used to define generic attribute definitions for a variety of fields/elements, so you have to define them just once Regular Smiley


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37884 posts
# Posted on: 30-Apr-2016 11:22:35.  
The bug you reported has been fixed, it's available in the latest 5.0.1 hotfix build in the customer area.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
jovball
User



Location:
USA
Joined on:
23-Jan-2005 19:53:47
Posted:
393 posts
# Posted on: 03-May-2016 13:05:36.  
Frans:

My organization is in government. We have started the purchasing process for v5 but it often takes a few weeks for that to complete. Can you update the build in the trial download as well?


Joel Reinford
LLBLGenPro Version: 5.5.3
Templates: Adapter
Framework: .Net 4.6
Database: SQL Server 2012/2014, DB2 v10
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37884 posts
# Posted on: 03-May-2016 15:06:47.  
jovball wrote:
Frans:

My organization is in government. We have started the purchasing process for v5 but it often takes a few weeks for that to complete. Can you update the build in the trial download as well?

No, not yet, sorry. We'll look at releasing 5.0.1 later this week (Friday).
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37884 posts
# Posted on: 05-May-2016 13:51:12.  
5.0.1 is now available (also in trial).

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.