Book a Demo

Author Topic: Get Name of Opened Project in C#  (Read 6213 times)

Ceronimo

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Get Name of Opened Project in C#
« on: April 11, 2016, 06:07:20 pm »
How can i get The Name of the opened Project ?
like f.e. myTextboxName=Attribute.Name;

?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Get Name of Opened Project in C#
« Reply #1 on: April 11, 2016, 06:38:10 pm »
Repository.ConnectionString has this information.

q.

Ceronimo

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Get Name of Opened Project in C#
« Reply #2 on: April 11, 2016, 08:12:04 pm »
thank you,
worked for me have cut the string.
it give the path back

greetz Ceronimo

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Get Name of Opened Project in C#
« Reply #3 on: April 11, 2016, 09:06:44 pm »
Hello,


Just to clarify this for anyone else who comes across this thread: there is no such thing as a project name in EA.
There is a project GUID, which you can get from the Repository class, but EA does not have a concept of a project name. That bit of text you see in the window's title is taken from different sources and does not correspond to anything in the EA database.

The "name" can be an alias taken from the DBMS connection string (which also holds the server and database name), or the file name if you're using .EAP projects or EA shortcut files.
The only case where you are guaranteed that the name will be the same for multiple users is if you're using an .EAP file. In the other cases, different users may have different names for the same project.

Depending on what you want to do with the text you extract, this may be important or it may not be. But in EA, projects do not have names.


/Uffe
My theories are always correct, just apply them to the right reality.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Get Name of Opened Project in C#
« Reply #4 on: April 12, 2016, 09:34:25 am »
Hello,


Just to clarify this for anyone else who comes across this thread: there is no such thing as a project name in EA.
There is a project GUID, which you can get from the Repository class, but EA does not have a concept of a project name. That bit of text you see in the window's title is taken from different sources and does not correspond to anything in the EA database.

The "name" can be an alias taken from the DBMS connection string (which also holds the server and database name), or the file name if you're using .EAP projects or EA shortcut files.
The only case where you are guaranteed that the name will be the same for multiple users is if you're using an .EAP file. In the other cases, different users may have different names for the same project.

Depending on what you want to do with the text you extract, this may be important or it may not be. But in EA, projects do not have names.


/Uffe
Along the same lines as Uffe has mentioned, we've gone to the extent of having a Top level branch called Instance:<Name> where we name the Repository in the repository itself.  As we use a number of very similar/clones of our main repository - and in any event our repositories have the same high-level structure, we need to make sure we're looking at the right one.   Indeed, as we make our clones (during overnight./backup processing) we rename the package and even test to make sure we're dealing with the right one in the right state.

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Ceronimo

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Get Name of Opened Project in C#
« Reply #5 on: April 13, 2016, 03:35:00 pm »
Top Feedback.
Thank you !