Making Elements as composite in enterprise architect - enterprise-architect

In EA through automation if element has to be made as composite then the API is Element.SetCompositeDiagram(Diagram.DiagramGUID) So in the EA table where to find this Value set in the t_object table.

A composite element is marked with
t_object.NType = 8
To complete this, you need to set
t_diagram.ParentID = t_object.ObjectID
or Element.ElementID of the composite element.

Related

Enterprise Architect: How to change type of element?

I have an element which is created as a table. In the "Element Properties" window, I see the Type is Class and Stereotype is table. For other similar tables, the Type is Table and Stereotype is table. Something seems to be icky with this particular instance.
However, when I run the following script
var element as EA.Element;
element = Repository.GetTreeSelectedObject();
Session.Output(element.Type);
The result is (for both tables!) Class. I thought to outsmart the EA UI by programmatically setting the type, but as both tables (the OK table and the "broken" table) both produce Class when asked for the .Type, I'm hesitant to set the .Type using a script.
I have thought about removing this table and re-adding a new one, but this is tedious as the table has a lot of connections.
How to change the Type of this particular "broken" table to "Table"?
The problem is that both «table» stereotypes are not the same.
The one where the type indicates Table is the correct one.
The other one is a rogue one.
Steps to solve this:
Remove the rogue stereotype from the internal stereotype list Configure | Reference Data | UML Types (to prevent the problem from happening again)
Change the stereotype from the problematic element to the stereotype «table» from the UML profile EAUML. In a script you can do this by setting the property EA.Element.StereotypeEx to the qualified name: EAUML::table). Manually you can use the [...] button to select the correct stereotype from the correct profile.

Filemaker: How to fetch list of related entities

I'm new to Filemaker, but have extensive SQL experience.
How do I add a list of children to my Filemaker layout, if I have a one-to-many relationship (a tree)? I would like to see for my current node all its children. Later I want to filter them as well.
Showing the parent is easy via the related field. But for the reverse it appears that I need to use scripts?
In SQL, I would write:
SELECT * from Element WHERE parent = {current_id};
You set up a relationship between the tables in the relationship graph using a primary key and foreign key arrangement. Then you add a portal to the related table occurrence on your main table layout. You can add filtering in the relationship itself or in the portal afterwards.
I advice you to check out this info from FileMaker on the subject.

Create One-to-One relationship based on PK of both tables

I'm really new to Entity Framework (currently using EF5) and vs2012 and am having difficulty trying to figure something out.
I have an .edmx that was generated from my database. It has two tables in it: Item and 3rdPartyItem. In short, the Item table is the main table for all the company items while the 3rdPartyItem table is a table that is used to hold additional attributes for items. This 3rdPartyItem table was created by an outside company and is used with their software for the company, so I can't mess with either table. What I'm trying to do is show a list of Items in a grid but I need to show a combination of all the fields for both tables. In vs2012, if I create a relationship and make it 'zero-to-one' (because for each record in the Item table, there doesn't necessarily have to be one in the 3rdPartyItem table), vs complains about not being mapped correctly. When I set the mapping, it then complains that there's multiple relationships. I did some research and found that you can't create a relationship with 2 primary keys, so I was thinking that was the problem. But how can I change the .edmx so that in code, I can access Items and 3rdPartyItem like so:
var items = dbContext.Items;
items.3rdPartyItem.SomeField <--field from 3rdPartyItem table.
not too sure if it's even possible, but it would be very, very helpful if so. Any ideas?
What you're looking for is table-per-type (TPT) mapping inheritance. You can view an MSDN walkthrough here (although you'd want your base type to be instantiable):
http://msdn.microsoft.com/en-us/data/jj618293.aspx

Entity Framework 4 many to many relationship issue

Considering this database:
This is what EF generates:
I think that HeroesItem class, is useless, and there should be a navigation property Items on Hero class and a navigation property Heroes on Item class.
I saw this can be done easily with code first, but how to get it done using database first?
It can be done only if your HeroesItems table does not contain Id column and instead uses IdHero and IdItem as composite primary key. Once you add any additional column to junction table you must map it as entity to have control over that column.

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.