Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Designer> Newbie Question
 

Pages: 1
Designer
Newbie Question
Page:1/1 

  Print all messages in this thread  
Poster Message
timbered
User



Location:
Philadelphia, PA USA
Joined on:
09-Feb-2020 05:01:06
Posted:
28 posts
# Posted on: 09-Feb-2020 05:13:10.  
Ok, I am a very new user to LLBLGEN, and I have a really basic question. My apologies if it's answered somewhere else, but I haven't found it.

I'm using version 5.6.1

I'm doing a Model First, and I want to specify the String type for a particular field to be converted to VARCHAR in Sql Server, instead of NVARCHAR like it's currently doing.

According to this:

https://www.llblgen.com/Documentation/5.6/Designer/Functionality%20Reference/ProjectSettings.htm#conventions-entity-model-type-conversions

It says:

Quote:
To edit type conversions for a given project, right-click the project node in Project Explorer and select Edit Type Conversion Definitions... or select Project -> Edit Type Conversion Definitions... from the main menu.


However, I don't have either of those options on my menus. What am I missing?

  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
38090 posts
# Posted on: 09-Feb-2020 10:11:36.  
First apologies for that incorrect remark in the documentation. That's an outdated reference, we'll correct the docs a.s.a.p. Regular Smiley

You have two options: if you want to have all string typed fields to be varchar, you can do that with one checkbox: Project -> Settings -> Conventions / Entity Model / Model First Development and uncheck 'Prefer natural character types'

If you want to have just a couple of fields to have a varchar db type, you should define a new type shortcut: Project -> Settings -> Conventions / Entity Model / Type Shortcuts.

In the top row of the grid type a new name for your typeshortcut, like 'vstring', specify the .net type as System.String and give it a default length. Press ctrl-enter to add the new row.
Select it, and you can then specify a preferred DB Type for this new type shortcut. Select SQL Server for the Database type, and as preferred DB Type 'varchar' and click OK.

Now in the entity editor (or quickmodel) you can use the 'vstring' type shortcut as the type for the field, instead of the 'string' type shortcut.

WHen you now sync the model using 'Sync Relational Model Data' the fields of type 'vstring' will be mapped onto varchar fields. Caveat: if they previously were mapped to nvarchar fields, the table fields won't be changed, as the designer doesn't see a necessity to change the target fields (as nvarchar is a valid target field for 'system.string'), hence the 'preferred db type'. To overcome this, on the mappings tab of the entity, select the field, click 'Edit field' in the bottom right corner to change the target field's type to varchar. You can then export a ddl sql script to apply that change to your database.


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



Location:
Philadelphia, PA USA
Joined on:
09-Feb-2020 05:01:06
Posted:
28 posts
# Posted on: 09-Feb-2020 22:38:49.  
Ah! Now I don't feel so bad. That's what I get for reading the manual. Laugh

Again, my apologies for such a basic question, but thanks for your quick and detailed response!
  Top
Pages: 1  


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

Version: 2.1.12172008 Final.