Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Custom Types without a TypeConverter
 

Pages: 1
LLBLGen Pro Runtime Framework
Custom Types without a TypeConverter
Page:1/1 

  Print all messages in this thread  
Poster Message
sparq
User



Location:

Joined on:
14-Mar-2010 22:56:10
Posted:
49 posts
# Posted on: 06-Apr-2017 00:26:46.  
Hi There,

Is it possible to override the default data type determined by LLBLGen designer for particular fields either in the designer or by modifying templates? (I'm using 2.6)

I'm using Oracle(10g) and it would be awesome to be able to change a System.Decimal to a System.Int32 (or System.Int16 to System.Int32 for smaller columns) without having to go through a type converter.

Essentially I want to change the IDataReader getter method used.

I'm more than happy to wear the responsibility of under/overflows - I just want to say "Trust me, GetInt32 will work"

Thanks,
Ben
  Top
sparq
User



Location:

Joined on:
14-Mar-2010 22:56:10
Posted:
49 posts
# Posted on: 06-Apr-2017 00:42:09.  
I just had a closer look at the generated code and it looks like IDataReader.GetValues is being used to return the entire record contents as an object array.

So - Is it possible to change the entityInclude.template to change the value of "TypeOfField"?

Here's a snippet from the template;

Code:

<[Foreach EntityField]>
        /// <summary> The <[EntityFieldName]> property of the Entity <[CurrentEntityName]><br/><br/>
        /// <[Foreach CustomProperty EntityField]>
        /// <[CustomPropertyName]>: <[CustomPropertyValue]><br/><[NextForeach]></summary>


Within that "Foreach CustomProperty EntityField" loop I would like to check if CustomPropertyName is "TypeOfField" and if so, replace the contents of TypeOfField with CustomPropertyValue.

That way I can add custom properties like "TypeOfField=System.Int32" and at least override the casting of types.

Could you let me know the syntax for that? <[If CustomPropertyName Eq? "TypeOfField"... how would this look?]>


  Top
sparq
User



Location:

Joined on:
14-Mar-2010 22:56:10
Posted:
49 posts
# Posted on: 06-Apr-2017 02:01:32.  
OK sorry about this - just tested this and a straight cast from object[] containing decimal values results in a InvalidCastException.

Never mind about this question then - feel free to close the thread as this is an Oracle issue which can't be overcome so easily.
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37866 posts
# Posted on: 07-Apr-2017 10:00:11.  
object to decimal casts sometimes fail, you should use the .NET Convert.To* methods instead Regular Smiley

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.