Note: this article will mention a free tool “Enar Spy” for Enterprise Architect. Get more information here: https://blog.lieberlieber.com/2011/09/22/enar-spy-update/


  • What are attributes?

In .NET attributes are used to combine code with declarations. e.g. is the class serializable, or is the property readonly.
Get more information here: codeproject

  • My Scenario:

In the internet you can find a couple of blogposts, dealing with setting attributes at runtime . I needed this to build a read-only property Grid, without modifying all the objects, I want to display.

Most information of this article is based on: dotnetfacts

In a short summary: the read-only attributes are set on all public properties except collections.  This is to keep the CollectionEditor button alive, which is disabled when setting readonly= true on collections too.

  • What I did:

You cannot create property-based attributes during runtime, but the readonly attribute exists for each property of your class by default. Even, if you do not add the Line “[ReadOnly(false)]“.
This is, why the following code-snippet works. It sets the readonly-attribute on each public property except collections.
change attributes at runtime

  • My Problem:

When assigning the class to the Property-Grid, all properties are displayed readonly. And next to collections you still have the button to investigate them.
But when opening the CollectionsEditor you might discover the following:

Although class “Connector” contains more properties than just a ToString-Method, it is treated like a string object.
For a tool like “Enar Spy” this is totally worthless, as you cannot investigate any collections.

  • Solution:

By accident, I found an article mentioning my problem in a single sentence:
“Add the readonly-attribute to your class’ properties declaration (= in source code). Because if you don’t, .NET will mix it up and do some crazy stuff.”
(Shame on me, I do not remember, where I found that hint!)

That’s why I ended up adding the line “[ReadOnly(false)]” to each property of each class I use in Enar Spy.

And guess what?
The propertyGrid’s collection editor now works like a charm:

This issue definitely needs some more investigation.

Does anybody have more information about this topic?

I appreciate each comment to this topic!

Share and Enjoy:
  • Technorati
  • Digg
  • Facebook
  • del.icio.us
  • Live
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • TwitThis
  • Blogosphere News
  • Blogplay
  • LinkedIn
  • MisterWong
  • MisterWong.DE
  • MSN Reporter
  • MyShare
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Webnews.de
  • Yahoo! Bookmarks
  • Yigg

Zur gestrigen Eröffnung des neu gestalteten Microsoft-Headquarters in Wien gratulierten wir als Microsoft TAP-Surface-Partner mit einer Surface-Applikation zur Versendung von Postkarten mit eigenem Foto. Der Surface steht im mit allen technischen Finessen ausgestatten Executive-Raum gleich im Eingangsbereich. Von hier aus werden nächste Woche sicher viele Microsoft- Partner und –Kunden im Zuge der Hausführungen Surface-Grüße in alle Welt versenden. Wir freuen uns mit Microsoft auf das Neue Arbeiten!

Bild_MS_Eröffnung_Band_MS

Eröffnung des neuen Microsoft Österreich Office am 12. Oktober 2011 (v.l.n.r.): Petra Jenner, Geschäftsführerin Microsoft Österreich, Renate Brauner, Vizebürgermeisterin und Stadträtin Stadt Wien, Jean-Philippe Courtois, Präsident Microsoft International und Brigitte Jank, Präsidentin der Wirtschaftskammer Wien (Bild: Microsoft)

Share and Enjoy:
  • Technorati
  • Digg
  • Facebook
  • del.icio.us
  • Live
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • TwitThis
  • Blogosphere News
  • Blogplay
  • LinkedIn
  • MisterWong
  • MisterWong.DE
  • MSN Reporter
  • MyShare
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Webnews.de
  • Yahoo! Bookmarks
  • Yigg

Click-once was not designed for registering com-components. These things are part of the work Windows Installer is meant for.
To use ActiveX in click-once applications too, remember these words: “Reg-Free COM“.

Here’s a short summary of what to do in a .NET project:

  • register the ActiveX Control on the developer’s machine.
  • add the control to a form
  • visual studio will add a reference to it.
    in solution explorer navigate there, and set it’s properties to “isolated” and “copy local”.
  • compile the project. VS will create a manifest to allow the usage of the activeX without registering it.
  • copy the activeX control to your output folder
  • Test it by compiling your app, unregister the control, and start your app.
    Lucky you, it will operate as desired.

Requirements: Windows XP and above, Visual Studio 2005 and above.

Note: Not every component is meant for Reg-Free COM, but in most cases it works.
And: it must be registered on the computer, the app is compiled on.

Get more information here (msdn magazin).

Share and Enjoy:
  • Technorati
  • Digg
  • Facebook
  • del.icio.us
  • Live
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • TwitThis
  • Blogosphere News
  • Blogplay
  • LinkedIn
  • MisterWong
  • MisterWong.DE
  • MSN Reporter
  • MyShare
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Webnews.de
  • Yahoo! Bookmarks
  • Yigg

If you model and simulate behaviors using Enterprise Architect and AMUSE some Mock UIs based on Windows Forms can improve your model significantly.
AMUSE WindowsForm_without_VS

How you can do that in a simple way? In that case you typically need to:

1. setup an Visual Studio Project and take care of some settings (e.g. usage of 3.5 NET); 2. develop a form; 3. compile the VS project into assembly; 4. import the form into your EA model, AMUSE reverse engineers it from the assembly and create a form class; 5. create an attribute in the class, that contains the state machine of type of reverse engineered form class; 6. connect form events with the state machine triggers; 7. initialize your form at state machine initializing phase
We recommend not import the form class directly but rather to create a wrapper class that contains only the events and methods you really need for modeling, otherwise the reverse engineered form class contains too much stuff inherited from the Form basis class. That means you have basically one more step to do.

The described procedure is not really complex and after performing it once you have a reusable template. In addition you develop and test the UI in very comfortable VS development environment.

But what if the usage of VS is not an option or you just want to perform the whole modeling using EA environment only?
– Not a problem at all Winking smile. Following XMI contains a simple model including an integrated Windows Form: simple model including an integrated Windows Form
Please find below the corresponding video:

Login Windows Form integrated in a EA UML model

(weiterlesen…)

Share and Enjoy:
  • Technorati
  • Digg
  • Facebook
  • del.icio.us
  • Live
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • TwitThis
  • Blogosphere News
  • Blogplay
  • LinkedIn
  • MisterWong
  • MisterWong.DE
  • MSN Reporter
  • MyShare
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Webnews.de
  • Yahoo! Bookmarks
  • Yigg

Im ersten Teil „Business Solutions entwickeln mit OCF“ wurde beschrieben, wie einfach man zu einem fertigen Grundgerüst für eine Business Solution kommt und wie man mit Hilfe des Entity Wizard alle benötigten Klassen für einen neuen Businessobjekttyp bekommt.

Die konkrete Implementierung einer beispielhaften Businesslogik ist das Thema dieses Artikels. Mit OCF lässt sich jede Art von Businesslogik umsetzen, jedoch wird die Umsetzung von Anwendungen für den Verwaltungssektor besonders unterstützt. Im letzten Artikel wurde schon kurz beschrieben, welche Entity Typen der Wizard anbietet. Businessobject, BaseDocument und Businesscase sind Typen, die in eGov-Fachanwendungen sehr häufig vorkommen. Businessobject ist das Basisobjekt eines jeden Geschäftsobjektes, enthält u.a. ein Property Identificationstring zur Darstellung der Aktenzahl bzw. Geschäftszahl. BaseDocument und Businesscase (Geschäftsfall) sind Ableitungen.

Im Beispiel werden 2 Entities erzeugt: File (Akt) und Document. File wird auf Basis des Entity Typs „Archive Object“ erzeugt, Document mit „Base Document“. Document erhält zusätzlich noch einen Foreign Key, der auf „File“ verweist.

clip_image002

clip_image004Damit erhält man alle benötigten Klassen.

Im Design Modus des LinqToSql Mapping Files „Entities.dbml“ fügt man jetzt manuell eine Association zwischen „File“ und „Document“ ein. Damit wird „File“, also der „Akt“, zum Container für Dokumente. Ein typischer Use Case im Verwaltungsbereich.

clip_image006

Als nächstes folgen ein paar notwendige Anpassungen. Der DataContract „File“ muss um ein Property „Documents“ erweitert werden.

image

Die Klasse “FileTranslator”, die das Business Entity „File“ in den DataContract „File“ übersetzt, muss ebenfalls angepasst werden, damit etwa beim Abfragen eines Aktes die verlinkten Dokumente gleich mitgeliefert werden.

image

Damit sind die Vorbereitungen fertig und man kann die Service Methoden implementieren, beispielhaft die Methoden „CreateFile“, „CreateDocument“ und „GetFileByID“.

Dazu öffnet man das Interface „IBusinessService“ im Contracts-Projekt und ergänzt die Methoden.

image

Die Implementierung des ServiceContracts könnte so aussehen:

image

Damit ist die Implementierung der Businesslogik fertig. Nach dem Update der Service Referenz im Client-Projekt, kann man auf die Service Methoden zugreifen und ein kleines Testprogramm schreiben.

image

Damit hat man bereits das Grundgerüst einer „ELAK konformen Fachanwendung“. Eine interessante Erweiterung des Beispiels wäre die Anbindung an den Dms Service Ocf|Dms. Jedes Document Objekt wäre dann mit einem Content verlinkt.

Share and Enjoy:
  • Technorati
  • Digg
  • Facebook
  • del.icio.us
  • Live
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • TwitThis
  • Blogosphere News
  • Blogplay
  • LinkedIn
  • MisterWong
  • MisterWong.DE
  • MSN Reporter
  • MyShare
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Webnews.de
  • Yahoo! Bookmarks
  • Yigg

Die LieberLieber Software GmbH liefert mit dem Open Components Framework (OCF) ein Entwicklungswerkzeug zur Generierung von Business Solutions. Die Architektur von OCF ist SOA basiert, also serviceorientiert. Ein vollständiger Datenlayer erleichtert die Umsetzung der gewünschten Businesslogik.

Setup: Nach der Installation stehen das Solution Template “OCF Business Solution” und der Entity Generierungsassistent “OCF Entity Wizard” zur Verfügung.

image 

Aufbau: Eine Business Solution wird nach einem vorgegebenen Pattern gebaut. Sie besteht nach der Generierung über das Template aus drei Projekten. Die Basis der Business Solution bildet ein WCF Service (Businessobjekt Service), der den wesentlichen Teil der Businesslogik enthält. Das Contracts-Projekt enthält die ServiceContracts und DataContracts. Das Client Projekt ist eine WPF Applikation mit einer Service Referenz auf den Businessobjekt Service.

Businesslogik: Für jede Entity werden eine Klasse im LinqToSql Objekt Modell (dbml file), eine DataContract Klasse, ein Repository (Entity factory) und ein Translator (übersetzt Entity in DataContract bzw. vice versa) benötigt. Diese Infrastruktur wird auf Wunsch generiert. Jedes generierte Repository ist von einem Basis Repository abgeleitet (Generic Repository, BusinessObject Repository, …). Das gleiche gilt für die anderen generierten Klassen. Etwa bei Wahl des Templates „Business Object“ wird das neue Repository vom BusinessObject Repository und der DataContract vom Basis DataContract „Business Object“ abgeleitet. Bei der Entity Klasse wird in diesem Fall das Interface IBusinessObject implementiert.

clip_image007

Für die Erzeugung dieser Infrastruktur gibt es den OCF Entity Wizard. Über den Menüeintrag „Create OCF Entity“ im Kontextmenü des Service Projekts startet man den Wizard. Sollen die Entity Klasse als auch die Tabelle in der Datenbank automatisch erzeugt werden, wählt man „Create new entity“. Im nächsten Schirm wählt man den Namen der neuen Entity, den Entity Typ (Objekttyp Template) und optional zusätzliche Felder aus. Es gibt zur Zeit fünf Entity Typen: Base Object, Archive Object, Business Object, Base Document und Business Case.

image

Mit Abschluss des Wizards werden die neuen Klassen erzeugt und man kann loslegen mit der Implementierung der eigenen Businesslogik.

Mehr dazu auf http://www.lieberlieber.com/Ocf.

Share and Enjoy:
  • Technorati
  • Digg
  • Facebook
  • del.icio.us
  • Live
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • TwitThis
  • Blogosphere News
  • Blogplay
  • LinkedIn
  • MisterWong
  • MisterWong.DE
  • MSN Reporter
  • MyShare
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Webnews.de
  • Yahoo! Bookmarks
  • Yigg

Maybe I should consider to rethinking my code style guidlines. As I opened my AMUSE project today I got the following message from Visual Studio (9.0).

Never seen it bevor ;)

image

Just checked witch file was responsible for this,… seems like VS doesn’t like the embedded MDG Technology file (XML) of Enterprise Architect.

Share and Enjoy:
  • Technorati
  • Digg
  • Facebook
  • del.icio.us
  • Live
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • TwitThis
  • Blogosphere News
  • Blogplay
  • LinkedIn
  • MisterWong
  • MisterWong.DE
  • MSN Reporter
  • MyShare
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Webnews.de
  • Yahoo! Bookmarks
  • Yigg