Showing posts with label work. Show all posts
Showing posts with label work. Show all posts

Nov 27, 2013

Repository Pattern Hell (Part 3): Enlightenment

comment on this

Modern object relational mappers have come a long, long way since the dark days of writing DataTableAdapters, CRUD stored procedures, or worse inlining dynamic SQL strings. In fact, they are so good now and come packed with so many fancy features it’s almost surprising people are still hung up on using the same old generic repository pattern that abstracts it all away and aims for the lowest common denominator.

Nov 26, 2013

Repository Pattern Hell (Part 2): Wish List

comment on this

It’s cathartic and whiny and all to bemoan the repository silliness as I have, but what about a real alternative? What is one supposed to do? Is there a better way? I’m glad you asked that!

Nov 25, 2013

Repository Pattern Hell (Part 1): Disillusionment

1 comments

The older I get the more I dislike the oft venerated Repository Pattern — at least as it is usually implemented and suggested. In fact, I’ve gone through just about every attitude, from ignorance, indifference, mild interest, eager learner, ardent supporter, frustrated friend, disillusioned, and now to somewhere close to outright disdain. Yep, I’ve become a hater, which isn’t something I like to be about anything… but here I am.

Nov 4, 2012

Aug 28, 2012

Restoring the Windows 7 Boot Choice After Installing Windows 8 on a Second Drive

1 comments

So, installed Windows 8 yet? Maybe you’ve got a fancy MSDN subscription, or maybe you’re a TechNet chap. Or maybe you’re still running the Release Preview. How are you liking it so far? Personally, I’m quite pleased with it.

Did you install Windows 8 on a new/second drive separate from your original Windows 7 installation? Maybe you were like me, hoping to keep it as a backup, just in case. I know especially during those older releases like the Developer Preview last year I wanted some insurance, and wasn’t ready to switch fully. Even now, I have some programs I still run on Windows 7 that I haven’t moved over yet. So, I installed the RTM version of Windows 8 on a second drive.

Everything installed great and I’m loving it so far. Except I don’t get a choice during boot-up to choose my OS!

Jun 14, 2012

Working hard versus working smart

comment on this

It isn’t every day that I get one of those moments of clarity. (Actually, if you’re a recruiter/interviewer reading this, that’s just narrative hyperbole! I get epiphanies, like, hourly. Yeah. Hire me.)

I’ve been tasked lately with some rather… interesting… problems at work. Really the circumstances around them drive me nuts and will have me bald from ripping my hair out but I can’t and won’t get into that here. I’m having to generate a lot of records to be imported into this other system as a sort of systems integration thing. Due to the fundamental differences in their database structures, it involves a lot of redundancy.

It also involves a lot of Cartesian products. What we would normally implement as a pair (or more) of drop-down lists to pick from we’re having to store as related elements. Allow me to illustrate with a contrived example.

Apr 4, 2012

MEF 2 Preview - Making tabs or windows share parts and scope

comment on this

I love MEF, but it isn't without its shortcomings. In previous versions, a big shortcoming was it's lack of anything other than shared or non-shared parts. Either it returned a new instance each time a given type was needed, or everybody got the same one. There was no [simple] way to define scope.

Mar 27, 2012

MEF 2 Preview - Discovering exports from previous versions of MEF

comment on this

Anybody that's felt adventurous enough to try out a preview of the next version of MEF might have run into a problem: it only discovers exports built with the same version of MEF! This might not be a problem for you if you only have one or two projects in your solution. But what about external assembly dependencies? Even if you technically have the source for them in other projects/solutions, it can be a pain to go through them all and rebuild them against the new MEF assemblies. Plus, anybody wanting to use them against the built-in 4.0 MEF will be screwed, which necessitates forking the projects or something else. And what about those assemblies for which you can't build yourself?

Mar 3, 2012

Implementing “Don’t show this message again” Using the WPF Task Dialog Wrapper

comment on this

A common feature of Windows applications for many years has been the useful little “don’t she me this again”-style check boxes that may appear in a dialog box. The Task Dialog API directly supports this feature, too, and as such my WPF Task Dialog Wrapper exposes it as well. Today, I’ll show you how to easily leverage this in a realistic scenario. For more about the wrapper itself, see my article on .

Feb 20, 2012

SQL Server Change Data Capture Functions Returning Nulls

comment on this

So we’re trying to set up Change Data Capture on our SQL Server database for one of our projects. The MSDN articles made it seem super simple to set up: just run a couple of stored procedures on your database and they do the work of creating schemas, system tables, and other functions for CDC use. Simple!

We made a few changes to data, noted the entries made in the capture instance tables, and naively thought everything was going fine. Called cdc.fn_cdc_get_all_changes_<capture_instance> and got back… nothing. Just a bunch of null values. Wha…?

Nov 7, 2011

Using the WPF Task Dialog Wrapper in an MVVM Application

comment on this

There's been a mini-flurry lately surrounding my WPF Task Dialog wrapper/emulator combo I blogged and posted about on last year. Mostly bug fixes, which I'm happy to try to tackle, and I appreciate that people seem to actually be using it (else how would they find these bugs?). It's given me a little boost of incentive to possibly do some actual new features and improvements.

Oct 17, 2011

Converting an image byte array into a usable WPF BitmapSource

1 comments

In a couple of our systems at work we store file attachments. The data gets put in a database table as a varbinary column. When we pull this down into our .NET apps, it’s represented as a byte[]. This is convenient to do image processing on it, as well as writing it to a file to be viewed, etc., but what about previewing straight in the application?

Oct 15, 2011

NETLOGON Event 3210 and Corrupted Domain Authentication Woes

4 comments

Was having an issue for several weeks at work where when I tried to run ASP.NET sites locally (debugger attached or not), I was getting an imposing YSOD:

The trust relationship between this workstation and the primary domain failed.

Sep 22, 2011

Some WPF Memory Leak Gotchas

comment on this

Just a couple of insights I recently gleaned tracking down memory issues. I used the CLR Profiler and it worked well with snooping on heap allocation to find out what references were still being held onto and by what objects.

Sep 21, 2011

Regaining Automatic Relationship Fix-Up with DbContext POCO Entities

5 comments

Recently at work I upgraded the WPF application project I've been working on for a few months now to Entity Framework 4.1 so that we could take advantage of the new DbContext class. It was a snap using NuGet, too. When we started, we used database-first and then generated POCO classes via the Entity Framework POCO Generator extension plugin.

I quickly noticed some problems in our application, though. Many of the method names are different between ObjectContext and DbContext, so it required a small bit of refactoring. I didn't have any problems with this, so I didn't suspect anything, but suddenly navigation properties were coming back null when they used to not be. We've got lazy-loading disabled (because we explicitly make data loading calls on asynchronous Tasks), but I was used to navigation properties being filled whenever its associated foreign key integer value changed, provided the associated object was already cached in the context.

Aug 16, 2011

A WPF SearchTextBox control

4 comments

Something missing from WPF (and the toolkit and even the extended toolkit) is a good reusable search box control. Well, now you too can have a pretty good one (if I dare say so). The need for one is so apparent that even Microsoft singles it out as a specific control in their guidelines*, which I used extensively to design the look and behavior of this control.

Too busy to read the details? That’s fine.

(Don’t forget to change the namespaces and image paths!)

See another of my custom WPF controls here.

Updated (9/27/2011): Added Luna.NormalColor.xaml and Classic.xaml files for XP and classic theme support.

Jun 9, 2011

Dynamic Data: to a faster, more featureful future of releases

comment on this

We’re (read: me and the sole intern) making a big push to impress internal clients (read: other employees) and my boss and her boss with some of the newer technology and features available in .NET 4.

May 11, 2011

WCF: pilot license required

comment on this

Listening to this Hanselminutes yesterday, I heard some great stuff from the always sagely Glenn Block on WCF. He’s apparently moved to that team (after working on MEF) to do something called Web API.

Boeing 767 cockpitHis analogy of WCF to a Boeing 747 cockpit had me fist pumping in shared understanding. I’ve spent enough painful hours flipping switches and knobs hoping for that one combination that will make it work, half the time not really knowing fully what I’m doing. It really did feel like being sat in front of the controls to a commercial aircraft and told “Okay, make it take off.” A seemingly simple, everyday thing for a plane to do, and it probably only takes a few flips of switches and a gentle movement of the controls to do it, but knowing which out of dozens of instruments will do it… well…

The sheer cliff of a learning curve with WCF has always put a sour taste in my mouth. RIA Services is wonderful if what you really want is just a data source for, say, your Silverlight app, but for anything else it’s not so helpful.

And as soon as you need to set up service credentials/certificates and/or a security token issuer and other “advanced” stuff it really starts to hurt.

That and there’s no way to encapsulate stuff into helper assemblies since so much of it must be done in the config file and referenced assemblies can’t have their own config info.

May 3, 2011

The dreaded 'has not been pre-compiled' message

comment on this

If you're "in-the-know" you've probably since stepped up to Web Application projects over the more ASP Classic-style Web Site projects. Along with that comes the Web Deployment Projects, which have had a version out for every Visual Studio since 2005. This project is basically a nice(r) front-end to MSBuild that lets you pre-compile the app, leaving only .aspx marker files instead of the raw html/code.

During your travels, you're bound to come across the infinitely misleading error after deploying your site using said deployment project:

The file 'MyPage.aspx' has not been pre-compiled, and cannot be requested.

Your first thought, like all of us, is "Umm, yes it has been pre-compiled. I just built the deployment for it, the page is a marker file, everything is in a .dll in the bin folder!"

And you're right, the page was properly pre-compiled. So why are you still getting this message?

It's a misleading one because generally the problem involves missing references on your deployment server/location. Something isn't installed into the GAC that your app is expecting to be there or you didn't include all assemblies in the build (Copy Local was set to false or something like that). What happens is the ASP.NET engine locates the marker, goes to find it in the assembly, fails to load it (because of missing reference) and thus is left with nothing, so it ends up throwing a "cannot find file" type error. That's not entirely true, but it doesn't know the difference. It went to load a page and got back nothing (because the loader failed to load it due to the missing assembly references).

Nine times out of ten it's a missing reference, though. Make sure all of the non-framework assemblies you've added have Copy Local set to true. If you've installed stuff into your development machine's GAC (ASP.NET AJAX Extensions was a common one back in the day) that hasn't been installed into the deployment server's GAC, either install it or include the assembly outright instead of relying on the GAC. ReportViewer references often cause this too since each Visual Studio version uses a different one (and generally doesn't include older versions).

Apr 19, 2011

ItemsControl hidden feature when binding to a list

comment on this

I've been battling (and finally, at last, solved) a particularly annoying problem lately which I was convinced for the longest time must be a bug. As usual, it was instead an undocumented feature. I tried to wait to write this so I wouldn't still be fuming after having torn my hair out for hours on end. I'll attempt civility, but if you detect a tinge of frustration you'll know why.