Copy / Paste support
The LLBLGen Pro designer supports full copy / paste (with multiple variants) of project elements. You can copy elements from the project explorer and paste them within the same project or in another project in another LLBLGen Pro instance. This feature is build upon the import system, so all elements which can be imported can also be copied. This also means mapping data and target elements.
Target elements are only copied to a different project if they're a table. All other elements (views, stored procedures, table-valued functions) can't be copied to a new project as there has to be a real element in a target database for these elements as their definitions aren't present in the LLBLGen Pro project. If the views/stored procedures/table-valued functions are present in the destination project, mappings are copied and will reference the existing elements.
VS.NET limitations
Copy/paste within the VS.NET extension is limited to the same VS.NET instance. You can copy/paste between LLBLGen Pro projects loaded in the same vs.net instance, but not between VS.NET instances or between the stand-alone designer and vs.net. This is due to how assemblies are dynamically loaded at runtime by VS.NET and binary serialization to/from the clipboard. If you need copy/paste between instances, use two standalone designer instances.
Copying data from the project explorer
The way the copy / paste system is intended is that the user selects one
or more elements in the project explorer and via pressing Ctrl-C
(which is the shortcut for the copy menu item), data is copied to the
clipboard.
Not all data can be copied, only elements which can be imported directly are copyable directly. This means that selecting fields, relationships, navigators and the like, they can't be copied, only entities, value types, typed lists, typed views, stored procedure calls, tvf calls, derived models and root derived elements.
Indirect copying elements
All elements which are required for the copied element but aren't selected, are copied indirectly. This means that if you e.g copy a Typed List, all entities in that typed list are copied as well, indirectly. The same goes for super-types in an inheritance hierarchy and entities referred to by copied derived elements or derived models.
The Copy command
The Copy command is present on the following node types in the Project explorer:
- Entity Model. This copies every element in the entire entity model
- Entities. This copies all entity instances below that node.
- Types Lists. This copies all typed lists and all referenced entities by those typed lists below that node
- Typed Views. This copies all typed views below that node
- Stored Procedure Calls. This copies all stored procedure calls below that node
- Table Valued Function Calls. This copies all table valued function calls and all elements referenced by them (entities, typed views) below that node.
- Derived Models. This copies all derived models below that node, all root derived elements in them and all elements referenced by those root derived elements directly or indirectly
- Derived Model. This copies the derived model and all root derived elements in them and all elements referenced by those root derived elements directly or indirectly
- Individual elements: Entity, Typed List, Typed View, Stored Procedure call, Table valued function call, Root derived element.
Pasting data
If the designer sees there's data on the clipboard in a recognized format, the Paste menu items are enabled. The paste menu items are only available on the context menu in the Project Explorer and only when the Project node is selected / right clicked or a groupnode is selected/right clicked.
Pasting data can be done in a couple of different ways:
- Paste Elements. This is the normal paste activated with
Ctrl-V
. This paste action will simply copy the elements without mapping data and targets into the destination project. Source group names will be honoured as-is. - Paste Full. This is the paste activated with
Ctrl-Shift-V
. This paste action will copy the elements with mapping data and targets into the destination project. Source group names will be honoured as-is - Paste Elements Into Specific Group. This is equal to Paste Elements but the destination group is a specific group specified by the user, which can be a new group. This paste doesn't have a shortcut key.
- Paste Full Into Specific Group. This is equal to Paste Full but the destination group is a specific group specified by the user, which can be a new group. This paste doesn't have a shortcut key.
The following Project Explorer node types have a Paste menu item. Which variants are available is described below using the numbers above.
- Project: 1 and 3. Paste will use the original group names / model names as the destinations.
- Entity Model: 1, 2, 3, and 4. Using any of the paste options will paste only entity model elements. Only on this node do 2 and 4 make sense.
- Group: 1 and 3. Paste will use the group name as the destination group. Using any of the paste options will paste only entity model elements.
- Derived Models: 1 and 3. Paste will use the original model and group names as the destinations. If there's no derived model data to paste, this option does nothing, even if there's entity model data to paste, it's ignored.
- Derived Model: 1 and 3. Paste will use the clicked derived model as the destinations. If there's no derived model data to paste, this option does nothing, even if there's entity model data to paste, it's ignored.
Creating a new instance vs. re-using an existing instance
When copying one or more elements and pasting them in the same or another project will always create new instances of the copied elements. However for indirectly copied elements this is different:
- When pasting into the same project the indirectly copied element will only be newly created if they're not present in the destination project; if they are present, the existing instances are re-used.
- When pasting into another project, the indirectly copied element will always be newly created, whether there's an element with the same name present or not: the element with the same name isn't re-used.
Example: you copy a Typed List T
with two entities, Customer
and Order
.
As you only copy T
, the entities it refers to, Customer
and Order
, are
copied indirectly. When T
is pasted into the same project, only a copy
of T
is created, and that copy will reference the same Customer
and
Order
entities.
If T
is pasted into another project, it will create T
and both the Customer
and
Order
entities and the relationship(s) between them. If there's already a Customer
present in the other project,
the indirectly copied Customer
entity will receive a suffix to make it unique, and will e.g. be renamed to Customer1
.