Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > General> Defining Enums
 

Pages: 1 2
General
Defining Enums
Page:1/2 

  Print all messages in this thread  
Poster Message
nw
User



Location:

Joined on:
09-Jun-2010 08:06:17
Posted:
42 posts
# Posted on: 29-Jun-2010 06:48:03.  
Are there any examples, for defining Enums so that I can assign them to fields? So far the closest thing I have found is in here http://www.llblgen.com/documentation/3.0/Designer/Functionality%20Reference/EnumTypeImports.htm

I have defined the location of the .typeimports file in the Designer using the AdditionalTypeConverter property and have also defined the enum in an assembly.

Code:

<typeImports>
    <typeImport typeName="TestEnum" assemblyFile="TypeLibrary.dll"/>
</typeImports>

namespace TypeLibrary
{
    public enum TestEnum
    {
        No,
        Yes
    }
}


However, when I reload the llblgen project file, and tried going to Field mappings for an entity, I cannot choose the Type Converter to use.

What am I missing or doing incorrectly?


  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
13799 posts
# Posted on: 29-Jun-2010 07:38:46.  
Does the field have the same type as defined in the TypeConverter?

  Top
nw
User



Location:

Joined on:
09-Jun-2010 08:06:17
Posted:
42 posts
# Posted on: 29-Jun-2010 08:24:58.  
Walaa wrote:
Does the field have the same type as defined in the TypeConverter?


How do you define the type? I can define the type in the .Net type column.
  Top
nw
User



Location:

Joined on:
09-Jun-2010 08:06:17
Posted:
42 posts
# Posted on: 29-Jun-2010 08:28:14.  
Where do you set the type?

  Top
nw
User



Location:

Joined on:
09-Jun-2010 08:06:17
Posted:
42 posts
# Posted on: 29-Jun-2010 08:31:00.  
Walaa wrote:
Does the field have the same type as defined in the TypeConverter?


Do you have to define a Type Converter? According to the documentation "...As all target frameworks support enum types directly, you don't need type converters to work with enum types"
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
34993 posts
# Posted on: 29-Jun-2010 09:27:01.  
You don't need a typeconverter for enums in v3.

There are a couple of things to check:
- where did you store the dll with the enum?
- when you right-click the project node in project explorer and select 'edit type shortcuts' can you define a shortcut for the enum type?


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



Location:

Joined on:
09-Jun-2010 08:06:17
Posted:
42 posts
# Posted on: 29-Jun-2010 10:21:28.  
Otis wrote:
You don't need a typeconverter for enums in v3.

There are a couple of things to check:
- where did you store the dll with the enum?
- when you right-click the project node in project explorer and select 'edit type shortcuts' can you define a shortcut for the enum type?



1) I mocked up a console app and so the dll with the enum is in bin\debug folder which is the exact same path as defined for AdditionalTypeConverterFolder in Designer Behaviour. I have also hard coded the full path in the typeImports file.

2) Nope. The enum is not there.

Anything I need to do to "compile" the enum? I am guessing only a restart of the LLBLGen is required.
  Top
nw
User



Location:

Joined on:
09-Jun-2010 08:06:17
Posted:
42 posts
# Posted on: 29-Jun-2010 10:37:20.  
Attached is a sample console app that I have created.

1) VS solution in llblgen\AxProjConsoleApp\ConsoleApp folder (ConsoleApp.sln)
2) LLBLGen project in llblgen folder (AxProj.llblgenproj)
3) DDL script in llblgen folder (DDLSQL_CreateScript_20100629-092215.sql)


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
34993 posts
# Posted on: 29-Jun-2010 21:51:53.  
It looks like you use .NET 4. You compiled the enum assembly as .net 4 assembly? Because that won't work as the designer runs on the .NET 2.0 (.NET 3.5) clr. If you want to run the designer on the .NET 4 clr, please open llblgenpro.exe.config in a text editor and uncomment the commented out xml lines as described in comments in that file.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
nw
User



Location:

Joined on:
09-Jun-2010 08:06:17
Posted:
42 posts
# Posted on: 30-Jun-2010 03:06:55.  
Otis wrote:
It looks like you use .NET 4. You compiled the enum assembly as .net 4 assembly? Because that won't work as the designer runs on the .NET 2.0 (.NET 3.5) clr. If you want to run the designer on the .NET 4 clr, please open llblgenpro.exe.config in a text editor and uncomment the commented out xml lines as described in comments in that file.


I uncommented the following:
Code:

<supportedRuntime version="v4.0.30319"/>

<legacyCasPolicy enabled="true" />


And it is still not working. Anything else that I missed?


  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
7667 posts
# Posted on: 30-Jun-2010 06:18:40.  
I think I got it Regular Smiley The typeName must be the full class name. So please use this:
Code:
<typeImports>
    <typeImport typeName="TypeLibrary.TestEnum" assemblyFile=".......\TypeLibrary.dll"/>
</typeImports>

... and to be able to use your type in entity editor, add a Type Shortcut Definition for it.
David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
nw
User



Location:

Joined on:
09-Jun-2010 08:06:17
Posted:
42 posts
# Posted on: 30-Jun-2010 08:04:26.  
daelmo wrote:
I think I got it Regular Smiley The typeName must be the full class name. So please use this:
Code:
<typeImports>
    <typeImport typeName="TypeLibrary.TestEnum" assemblyFile=".......\TypeLibrary.dll"/>
</typeImports>

... and to be able to use your type in entity editor, add a Type Shortcut Definition for it.



Works! Thank you!


  Top
nbrake
User



Location:
Hamburg, Germany
Joined on:
18-May-2008 22:27:47
Posted:
30 posts
# Posted on: 24-Feb-2011 14:19:09.  
Hi there,

my problem is similar so I opted for keeping the thread!

I have defined an Enum:

Code:

namespace Wk.ImportTypes
{
    public enum Status : byte
    {
        NichtBearbeitet,
        Bestaetigt,
        Veraendert
    }
}


and an importtypes file:
Code:

<typeImports>
    <typeImport typeName="Wk.ImportTypes.BearbeitungsStatus" assemblyFile="Wk.ImportTypes.dll"/>
</typeImports>


Right-clicking on project, I can define the type in the Type Short Cut editor. I called the short cut Status.

I have a table with columns defined as tinyint. There columns are mapped to c# byte. When I edit the field mappings in entity editor, I am unable to choose the Status type for mapped fields of type byte.

Would really appreciate any help on this!

Best regards

Nasser
  Top
MTrinder
User



Location:
London by day, Milton Keynes by night.
Joined on:
08-Oct-2008 17:55:47
Posted:
1461 posts
# Posted on: 24-Feb-2011 20:50:35.  
Quote:
my problem is similar so I opted for keeping the thread!
Please start new threads as it makes it easier for us to track current topics.

Can you select your status for any other column types ?

Matt


  Top
nbrake
User



Location:
Hamburg, Germany
Joined on:
18-May-2008 22:27:47
Posted:
30 posts
# Posted on: 24-Feb-2011 20:52:34.  
sorry for the thread issue.

I cannot choose the shortcut for any type at all.
  Top
MTrinder
User



Location:
London by day, Milton Keynes by night.
Joined on:
08-Oct-2008 17:55:47
Posted:
1461 posts
# Posted on: 24-Feb-2011 20:58:21.  
Which folder is your .dll (which contains the enum) located in ?

Matt


  Top
nbrake
User



Location:
Hamburg, Germany
Joined on:
18-May-2008 22:27:47
Posted:
30 posts
# Posted on: 24-Feb-2011 21:04:52.  
The dll is in a folder that is given as a relative path in an .typeimports file. The dll is being read, as I am able to see the enum type in the Type Shortcut Editor. There I am able to create the Shortcut. When I go into Field mappings, and try to choose a shortcut from TypeConverter to use column, none are available.

Thanks for your help!
  Top
MTrinder
User



Location:
London by day, Milton Keynes by night.
Joined on:
08-Oct-2008 17:55:47
Posted:
1461 posts
# Posted on: 24-Feb-2011 21:17:07.  
Can you attach or send us your .dll (or the code to build it) and we'll investigate.

Thanks

Matt


  Top
nbrake
User



Location:
Hamburg, Germany
Joined on:
18-May-2008 22:27:47
Posted:
30 posts
# Posted on: 24-Feb-2011 21:19:25.  
The dll only consists of the enum, nothing else!
  Top
MTrinder
User



Location:
London by day, Milton Keynes by night.
Joined on:
08-Oct-2008 17:55:47
Posted:
1461 posts
# Posted on: 24-Feb-2011 21:21:42.  
How do you have the shortcut defined ? (Screenshot...?)



  Top
nbrake
User



Location:
Hamburg, Germany
Joined on:
18-May-2008 22:27:47
Posted:
30 posts
# Posted on: 24-Feb-2011 21:54:06. Goto attachments  
Here is the screenshot.
  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
7667 posts
# Posted on: 25-Feb-2011 06:51:15.  
nbrake wrote:
Hi there,

my problem is similar so I opted for keeping the thread!

It's not the same problem as you can load your custom type.

nbrake wrote:
I have a table with columns defined as tinyint. There columns are mapped to c# byte. When I edit the field mappings in entity editor, I am unable to choose the Status type for mapped fields of type byte.

I can't reproduce your problem, with similar project (similar enum, column tyniint/byte) and I'm able to create the shortcut and assign that to the byte fields.

What LLBLGen build version are you using?
Could you post an screenshot or your .llblgenproj file?


David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
nbrake
User



Location:
Hamburg, Germany
Joined on:
18-May-2008 22:27:47
Posted:
30 posts
# Posted on: 25-Feb-2011 10:19:45.  
I am using LLBLGen Pro 3.0 final october 22nd. Attached please find the project file.
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
13799 posts
# Posted on: 25-Feb-2011 10:43:39.  
Quote:
I am using LLBLGen Pro 3.0 final october 22nd.

That's old.
To be on a common ground, could you please try with the latest release.


  Top
nbrake
User



Location:
Hamburg, Germany
Joined on:
18-May-2008 22:27:47
Posted:
30 posts
# Posted on: 25-Feb-2011 10:45:19.  
I will and then get back to you.
  Top
Pages: 1 2  


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

Version: 2.1.12172008 Final.