LLBLGEN, how to update an existing entity - llblgen

I have entity Customer under group name Customers
I moved the Customer entity to a new group TestCustomers
The Customer db table changes in the meantime renaming a field from LastName to Surname
I do a Refresh Relational Model Data from a Database in the Catalog Explorer
No changes can be seen in my TestCustomers\Customer entity as it still has a field named LastName
Is this because the Designer has some kind of binding between it and the old entity path Customers\Customer?
How can I achieve the update I want?

In LLBLGen Pro v3.5 you can try this:
In the Entity Editor, click on the Field mappings tab.
Click the Remove mapping button.
Click the Create mapping button.
Choose the correct target from the dropdown list.
This should re-create your entity including any new fields in your target db table.
There is also the Reverse-engineer unmapped target fields which can be used for this, but I found it was disabled for my entities until I remapped them. See documentation here:
http://www.llblgen.com/documentation/3.1/Designer/Functionality%20Reference/TypedViewEditor_FieldMappingsTab.htm

Related

Symfony2: Collection of dropdown select lists for a many-to-many relationship

The objective:
Having a many-to-many relation be displayed as a dynamic list of select inputs(single choice dropdown list)
User arrives on page with a single select field (multiple = false) populated with persisted entities and add/remove buttons. By clicking the add button, a new select field with the same options appears below the first, which adds a new entry in the M2M relation. By clicking remove the field disappears and the entry should be removed.
The model:
Two entities: User & Manager. A User has exactly one "special" Manager and unlimited normal Managers.
Managers manage unlimited users.To model this I have created two relationships for which the user is the "owner" (not sure how to translate this)
ManyToOne specialManager
ManyToMany normalManagers
I haven't created a many to many relationship with attribute "special" because the requirement is exactly one special manager and I wasn't sure if Symfony/Doctrine would cause problems down the line.
What I have:
I can display a multiple select field with the existing entities using Entity field type, as per the documentation. Functionally this is what I need, visually it is not.
I can also use the Collection field type to display a single text field, and add or remove more with JS, as per the documentation. Visually this is what I need, but The text fields (entity attribute) need to be replaced by choice field.
The question:
Before I continue digging, is there a simple way to achieve this list of select tags?
For anyone else who may eventually need a dynamic list of select fields:
I initially solved this issue by detaching the field(s) in event listeners, and handling the display/submission manually in the controller.
However I wasn't satisfied with this clunky solution and when I encountered the same need I used a second solution: creating an intermediary entity xxxChoice (in this case ManagerChoice) which is Mto1 inversed related to User and Mto1 related to Manager. Then by creating a ManagerChoiceType form with "Manager" entity field type I was able to easily display my collection of dropdown select lists.

Entity Framework - Entity not added to design surface

I attempted to update my edmx file by selecting a table. The tool spit out a info message that said the table did not have a primary key.
The entity did not get added to the design surface but it did get added to the .edmx file. In addition, using the model browser I see an Entities.Store and an Entities. My table got added to Entities.Store, but not to Entities.
I cannot access the table that was "added" in the code.
What do I do?
Steps to reproduce:
Create a SQL table with two columns that are both defined as foreign keys to other tables. Make sure the tables that the FKs point to already exist in the model on the design surface.
Right click and choose Update Model from Database...
Next. Under the Add tab, mark the new table under Tables
Click Finish.
An association will be created and it will be selected on the design surface, but it won't start with FK_, it will just be the name of your table. Go to the Model Browser and look under Entity Types. The table will not be there. Look under Associations and you will see your table name there as an association, but it will look out of place (because of the name).
Entity Framework was too smart for me. It created an association instead of an entity. Odd, but it works for how I need to use it.

How do I get the column name from an Entity Framework Association

I have an entity model built using the designer. In one of my tables (application), I have several foreign keys that reference the same status (status) table. As a result, when my associations were built, I have several entity objects built with an auto indexing name:
application_statuses2
application_statuses3
etc.
I'm building a "version history" type screen and want to be able to properly list the "friendly name" for each column modified. For example, I want to display "Destination Status" will be displayed instead of "application_statuses2". If I can determine the endpoint column name on the association in question, I can setup the proper display value.
I can find the entity object in the designer, I can even track where it references the foreign key in question that built the association, but I can seem to find the property that outlines the enpoints or column names. How do I determine the column name, or endpoint, on my association, or entity?
I wish it were more ready to hand, have been looking for it as well. Bit of a pain when you have multiple FKs to the same table.
Click on the navigation property you want to check
Under properties, look at the name of the association
At the top of properties, use the object navigator dropdown to switch to the association
Click into the 'Referential Constraint' property
Use the ellipses button on the right to bring up the column names
Dont know if there is a better way of doing this, but I certainly hope so!

MVC Entity Type Missing

I'm brand new to ASP.NET MVC (Literally just two days of learning on the fly). I'm trying to create a website using MVC, however, I've screwed something up in my solution.
I created this table that had foreign key constraints but I initially forgot to set up a primary key on the id field and forgot to set it identity specification to yes. So when I updated my DataModel and brought this table in, it showed every field as being the primary key and it showed the relationship to the other tables. So I went back to the database and changed the id field for the table to be the primary key and identity specification to yes.
I went back to the DataModel, tried to Update Model From Database, went to the refresh tab, expanded the tables, and selected the table I wanted to refresh, then click on "Finish".
The data model appeared to make the changes but it showed the relationships to the other tables twice.
So I thought I'd delete the table (entity) from the DataModel diagrahm and bring the table back in through Update Model From Database. But when I went back to the Update Model From Database...
Under the Add tab, the table isn't under the Tables
Under the Refresh tab, the table is listed, but when I select it and click on "Finish" the table doesn't reaapear in the diagrahm.
In the model browser...
Under Models
Entity Types, The entity isn't listed
Under Associations, The relationships no longer appear (obviously because the entity is gone).
Under Models.Store
Tables/Views, The table is listed.
Constraints, the relationships are shown.
I've tried dragging the table over to the diagrahm from the Model Browser, but that doesn't appear to work.
I've tried to right click in the diagrahm, add Entity but my table doesn't appear as a Base Type.
I've tried to google but I'm coming up with nothing. With this entity missing, I cannot even build my solution. Please help.
Try to delete the entity file and add it again. But you have to name it as previous entity and don't forget to delete the connectionString in web.config before add it.
If you don't know what I am saying just let me know.

ADO.NET Entity Data Model - Duplicates

How can I add a Unqiue index to a column like in SQL, so it wont allow duplicates in the column?
Double click your EDMX file. the entity model designer gui comes up.
Add one or more Entities if you don't have any already.
Select a field in an entity, and double-click it. The field property window should open up.
Select the property "ENTITY KEY" and set it to True.
As far as I understood, this makes the field unique.
Cheers,
G.