Browse Category

Work…

Accessing Entity Framework’s items with little help of metadata

Sometimes, when we work with database, we have to do some changes is some specific tables. It can be situation when we need correct some corrupted data in our system or compare some specific columns in tables between two databases. Instead of manual work with T-SQL scripts and spending effort to keep them up to date, we can write some program which will make our life easier on the one hand, and will save our time when it will come to maintenance. If we can use an ORM like Entity Framework then we can generate the model from the database, but here nice part ends. Now we will have few solutions available:

  • inspect our model with the help of “reflection” to discover the columns and properties which require our interference
  • modify T4 template, with which EF creates his objects, to inject some base classes or interfaces and to try to access the objects that way. Unfortunately not always we have opportunity to work with nicely structured database and not always making a change in T4 template is an easy task.
  • we can try to access metadata of Entity Framework and more easily access interesting objects for us to perform our modifications.

How we can access the metadata? Let’s see below
Keep Reading

TFS Build 2o12 & C# 6.0

Recently, just after migrating to Visual Studio 2015 we have noticed, that our Continuous Integration Build, which is using TFS 2012 is not quite happy about our recent check-ins. A quick investigation lead us to conclusion that one of us by mistake used new feature of C# 6.0. As Visual Studio compiled solution without errors, developer thought that everything is OK, as there was no sign of sudden failure.

The first idea was – we need to upgrade our TFS Builds – but it was “no go” for us as it would mean that we need to migrate all our custom build activities as well. Hopefully for us – there was also another solution – much easier one.
All we had to do was:

  1. Install Visual Studio 2o15 on Build machine
  2. Edit build process template and point MSBuild activities to new location with MsBuild 14.0

… after this small change, everything was working again. All green! ;o)

Panem et circenses – WROC#

Switzerland is a nice place to live 🙂 you have here almost everything – high mountains, good chocolate, tasty cheese and punctual trains.

What you don’t have (or barely have) are the good Developer’s Conferences. That is why, almost two weeks ago I went to Wroclaw in Poland to attend a WROC# Conference. This event was organised by none other than Objectivity Bespoke Software Specialists – my former employer – currently one of the best employers in Wroclaw! 😉

IMG_1009

Keep Reading

RadRichTextBox rendering problem when TextOptions.TextFormattingMode is set to “Display”

In Silverlight 5 you may make your application look better by changing the way fonts are rendered. You make this change by applying some additional setting in your App.xaml.

The whole instruction regarding this topic was described here.

Keep Reading

ListBox using WrapPanel with VerticalScrollBar

Recently I was using a ListBox in Silverlight together with the WrapPanel. Idea wasn’t too complicated, just a list and a button to add items. Each time the button was pressed, some items was generated in code behind and added to the list. If there was no space left for the new item, the wrap panel was expected to do his job, wrap the line and vertical scroll-bar was expected to be showed. So far so good… but it was not working as expected.
So the code was looking more less like this one:

Keep Reading

Thread & CurrentCulture

Recently I had quite interesting situation I was not fully aware of. The problem was, that user got the message from my application in one language, although he started application with another one.
What had happened was – the operation was executed in another thread, which had different culture settings (specific to local machine) than culture settings of my application – as a result other resources where read 🙂
Keep Reading

One NuGet please!

Gdybym wiedzial, ze tak bedzie, to bym tak nie zrobil“… czasem mozna powtarzac to jak mantre. Ktos kiedys, podejmuje jakas decyzje, ktora w danym momencie wydaje sie byc dobra (lub jest niedokonca przemyslana :)), decyzje ktora rozwiazuje pewien problem i dziala… dopoki nie pojawi sie inny, nowy 😉 wtedy podejmujemy nowa decyzje, ktora rozwiazuje stary problem, ten nowy i inny..potencjalny (jesli poswiecilismy chwile czasu na zastanowienie sie nad takim). I wszystko dziala… rzecz jasna… do momentu az nie pojawi sie kolejny problem X :). Dzis o jednej z takich decyzji podjetych w odpowiedzi na problem X…
Keep Reading

Improve your debugging with OzCode

Wczoraj pod wpisem Jarka na temat AutoMappera – kolega Łukasz Kurzyniec – umiescil link do ciekawej wtyczki do Visual Studio wspomagajacej programiste w procesie (jakze zmudnym czasami) debuggowania.
OzCode” bo o niej mowa, jest dzielem izraelskiej firmy CodeValue i poki co dostepna za darmo z racji wersji “beta”.

PostOZ_OzCode

Pobawilem sie nia troszeczke i musze przyznac ze prezentuje sie naprawde ciekawie. Ponizej kilka ciekawych funkcji jakie oferuje:
Keep Reading

Problems with debugging in Silverlight

Ostatnio zdarzylo sie u nas w firmie, ze jedna osoba (pracujaca na Windows 8) nagle przestala moc debuggowac aplikacje w Silverlight‘cie – co dziwne na pozostalych komputerach (z Windows 7) wszystko dzialalo w porzadku.

Jeden problem – ze miala problemy z uruchomieniem aplikacji (Visual Studio rzucal info “Unable to start program http://localhost…aspx“) pod IE, drugi – ze nie byla w stanie debuggowac aplikacji, nawet jesli ta byla np uruchomiona na innej przegladarce.

Probowalismy wszystkich znanych nam rozwiazan, sprawdzajac co moze byc nie tak … oraz rozne inne (czasami dziwne) rozwiazania zaproponowane w Internecie… jednak bez rezultatu.
Skonczylo sie na ticket’cie w Microsofcie i tu musze przyznac chlopaki z Microsoftu z Münich spisali sie naprawde fajnie i nastepnego dnia mielismy juz rozwiazanie na ten problem. Powod? W sumie zabawny… co ciekawe dziala rowniez na Windows 7 ale o tym ponizej.
Keep Reading

ReSharper i Visual Studio 2012 (Update 2)

Kilka dni temu Micorosft wypuścił Update 2 dla Visual Studio 2012. Kilka dni minęło, więc można instalować, pomyślałem sobie. Instalacja przeszła raz dwa, myślę .. musi działać 🙂
Wziąłem się do dalszej pracy i pech chciał, że akurat jeden UnitTest zapalił się na czerwono. Uzbrojony w ReSharper’a namierzyłem trefny test, klikam na zielone kółeczko obok testu “Debug”, czekam ….
Keep Reading

  • 1
  • 2