Marko Apfel - Afghanistan/Belgium/Germany

Management, Architecture, Programming, QA, Coach, GIS, EAI

  Home  |   Contact  |   Syndication    |   Login
  168 Posts | 2 Stories | 132 Comments | 4 Trackbacks

News



Twitter | LinkedIn | Xing

Article Categories

Archives

Post Categories

BizTalk

C#

Enterprise Library

SAP

SQL Server

Technologie

C#

With Entity Framework 5 in Visual Studio 2012 the code first feature could let you come to the question “Where is the automatically created database located?” I run in the question after changing the model which throws during the next run this error: “The model backing the 'MyContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fw... Okay – clear I thought “delete the database”. But where ......

Problem

When using xUnit and constructs like Debug.WriteLine the DbgView-tool does not show the written output anymore.

Solution

Add a new Listener – for example:

Debug.Listeners.Add(new DefaultTraceListener());

Motivation During programming suddenly this error (“Failure has occurred while loading a type”) was thrown by accessing a artifact of a referenced library. In such cases I take the assembly fusion logger fuslogvw to search for problems of loading assemblies. Sometimes an old version from a not expected folder is binded. But all bindings were correct. Problem After several hour I got the right hint. Because the assembly is a COM+ one, there are some registration things in die background – and I don’t ......

Motivation LINQ (language integrated query) is a component of the Microsoft. NET Framework since version 3.5. It allows a SQL-like query to various data sources such as SQL, XML etc. Like SQL also LINQ to SQL provides a declarative notation of problem solving – i.e. you don’t need describe in detail how a task could be solved, you describe what to be solved at all. This frees the developer from error-prone iterator constructs. Ideally, of course, would be to access features with this way. Then this ......

During playing with EF and LINQ I run in this UI-error: argument type ‘lambda expression’ is not assignable to parameter type ‘string’ The Compiler themselves states: Cannot convert lambda expression to type 'string' because it is not a delegate type. After some googleling I found, that a missing using directive is the problem. Inserting System.Linq fixed it ......

Intro If you want to test the internals of a productive assembly you must mark the assembly with the InternalsVisibleTo-attribute. This attribute has only one constructor which needs the name of the testing assembly. http://msdn.microsoft.com/e... So this looks like: [assembly: InternalsVisibleTo("Unlinke... Visual Studio and 3rd party plugins uses the string to mark referencing ......

Till yet I thought, that if you have an assembly in the GAC all referenced assemblies must also be in the GAC. So a break of this GAC-assembly resolving chain is impossible. This results in some annoying problems. Lets have a view at the following scenario: You write an own appender for log4net. You deploy your solution with log4net-assembly beside your application assemblies. Your appender is located in one of there application assemblies and log4net is configured to use this appender. Everything ......

If you develop ArcGIS Add-ins with Visual Studio under limited permissions you get during the build process an error, that the stuff could not be registered. Normally its enough to run one times this build as an admin. Then all needed information are set and also taken for users with limited access. So – how to suppress the registration task? If you look inside the running target (C:\Program Files (x86)\MSBuild\ESRI\ESRI.Arc... you will see these statements: <Warning Text="Skipping ......

Vorkenntnisse: Kenntnisse einer Programmiersprache sind hilfreich. Zielgruppe: Dieser Workshop richtet sich an alle Softwareentwickler und Softwarearchitekten, die Lösungen in Form von ArcGIS Desktop Erweiterungen oder ArcGIS Engine Anwendungen planen und entwickeln. Kurzbeschreibung: Professionelle Softwareentwicklung hat primär nichts mit Geld zu tun, oder mit der Verwendung teurer Entwicklungstools. Vielmehr basiert Professionelle Softwareentwicklung auf Werten mit dem Ziel, dauerhaft guten, fehlerfreien ......

If different implementations for the same interface are specified without named keys, then a resolving is made in order of the configurations. So the first fitting implementation is taken. Different implementations for the same interface is a typical scenario for patterns like “chain of responsibility” and “decorator”. If you want to describe such a chain you could use the next handler as a constructor- parameter in the actual one. Demo source code Lets have a look at code. Interface for one handler/processor/part ......

By pasting formatted text in Word and OneNote both applications act a little bit different. Meanwhile Word supports RTF-formatting OneNote does not. OneNote could only handle HTML-formatting. In combination with presenting source code for Visual Studio the Add-in CopySourceAsHtml is available. During copying with Edit > Copy As HTML some option must set – notably Include RTF should be deactivated: ......

Da gibt es unterschiedliche Auffassungen.

Im Englischen:

  • Func f = x => x * 2;
    ”x goes to x * 2”
    ”x maps to x * 2”
    ”x becomes x * 2”
    ”x induces x * 2”
  • Func test = c => c.City == "London";
    "c for which c.City equals London"

Im Deutschen:

  • Func f = x => x * 2;
    ”x wird abgebildet auf x + 2”
    ”x wechselt zu x * 2”

Problemkontext So schön auch das automatische “cleanup code refactoring” von ReSharper ist, im Zusammenhang mit Strukturdefinitionen, die als Übergabe-Parameter für unmanaged Code Aufrufe benötigt werden, lauert eine große Gefahr. Standardmäßig ist im Profil “Full Cleanup” die Option “Reorder type members” auf “Yes” gestellt. Und dann wird aus der originalen Definition: public struct TreeViewItem { public int mask; public IntPtr hItem; public int state; public int stateMask; } ein mit alphebetisch ......

Das Debuggen einer Applikation auf einem Rechner ohne installiertes Visual Studio gestaltet sich mit dem Remote Debugging Monitor relativ einfach. Derartige Konstellationen ergeben sich insbesondere dann, wenn ein Debugging von Anwendungen in Produktiv-Umgebungen notwendig wird. Die Maschine mit der Anwendung wird dann als Remote-Maschine bezeichnet und die, von der aus das Debugging gesteuert wird, als Debugging-Host. Anwendungsseitiges Vorbereiten der Remote-Maschine Eine Grundvorraussetzung zum ......

error MSB3105: The item "BALoginForm.resources" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter. Reason We use two custom cultures to divide between UIs for two customers. At the machine with this error only one custom culture was installed. Problem In production environments by the customers only one custom culture is installed. These installed custom culture we use to set the UI culture. This lets run us in the problem, that ......

Wie so oft im Leben sind manche Dinge auf den zweiten Blick komplexer als sie auf dem Ersten den Anschein haben. Es kam die Anfrage, ob es nicht doch einen Unterschied zwischen "as" und "is" gibt & dann wurden noch ein paar Inputs gefunden, dass im Falle des "Überladens von Cast-Operatoren" mögliche Fallen lauern. Für den Fall der Überladung muss man natürlich wissen, was der Programmierer bei der Überladung getrieben hat. Im ArcObjects-Kontext sollte man im Allgemeinen nicht in derartige Fallen ......

in unten stehendem Code ist ein Anti-Pattern, welches immer wieder im ArcObjects-Kontext zu beobachten ist. if (element is IMapSurroundFrame) { IMapSurround mapSurround = ((IMapSurroundFrame)element... .. Es wird eine is-Abfrage gemacht (element is IMapSurroundFrame) und dann ein Stück später der tatsächliche Cast ((IMapSurroundFrame)element). Im Hintergrund macht die is-Abfrage nichts anderes als einen Cast und schaut, ob der geht. Da ein Cast immer eine "teure" Angelegenheit ist, sollte ......

In our team we have developers with Visual Studio 2005 and 2008. Often we have projects which must be coded by a mixed team. Visual Studio 2005 and 2008 compatibility for project-files Normally this is no problem because adding projects in Visual Studio 2005 and manually introducing the ToolsVersion="2.0" attribut in the new csproj-file allows an coexisting working when using two sln-files for Visual Studio 2005 and 2008. We name the sln-files normaly <solution>.2005.sln and <solution>.2008.sln. ......

If you want specify log-parameters for loggers of a whole namespace normally you use a scheme like

<logger name="GrandNS.ParentNS.ChildNS.*" ..

this is the same like

<logger name="GrandNS.ParentNS.ChildNS" ..

There is no ambiguous name possible, because it is not allowed to define a class with the name of a namespace at the same namespace-level.


Often i see code-constructs like 1: try 2: { 3: string bitmapResourceName = GetType().Name + ".bmp"; 4: Bitmap bitmap = new Bitmap(GetType(), bitmapResourceName); 5: } 6: catch (Exception ex) 7: { 8: System.Diagnostics.Trace.Wr... bitmap."); 9: } The corresponding codetree has the structure: This works as so long as the bitmap is near the calling component and the names are similar. If the name of Form2 is changed (maybe through refactoring) the developer must remember, that there is ......

Beim Verwenden des Standard-Mechanismus zum Lesen von Konfigurationsdaten wird immer die config-Datei der EXE gelesen. Soll eine DLL über eine eigene Konfigurationsdatei verfügen, verwendet man die Klasse ExeConfigurationFileMap. Beispiel: 1: ExeConfigurationFileMap ecfm = new ExeConfigurationFileMap(); 2: ecfm.ExeConfigFilename = "MyLibrary.dll.config"; 3: Configuration cfg = ConfigurationManager.OpenMa... ConfigurationUserLevel.None); 4: AppSettingsSection ass = (AppSettingsSection) ......