Entity Framework Code First

I’m trying to wrap my head around the latest update to Entity Framework 4.1. I’m trying to use Code First to create an object model that will map successfully to an existing database.

So far I think it will work for my needs and I’m pretty sure it will be easier to program against since I can use Linq to Entities to query. It’s just a matter of figuring out how to make it work for what I need. So I’m tring to figure out Complex Types, but like everything I think I’m making it more complicated that it really is. I need to nest my complex types, but specify the column names. I’m guessing I can do that with the Fluent API via the entity that is using it as a property. See below.

public class Complaint
   public int ComplaintID {get; set;}
   public Location Location {get; set;}
public class Location
   public string County {get; set;}
   public decimal? Latitude {get; set;}
   public decimal? Longitude {get; set;}
   public Address Address {get; set;}
public class Address
   public string Street {get; set;}
   public string City {get; set;}
   public string ZipCode {get; set;}

In the context, I would define the column as such:


Is this the way to handle this? If someone sees this and can tell me if/where I’m wrong, please feel free to comment. I really would love to make this work. I would like to eventually use this model instead of the edmx or sqlDataSource I’m currently using. This model would be backing 2 projects (wpf desktop app and asp.net). And once I get this model figured out, I can do the same for a few other projects I’ve got.

I will have a lot of work to do but I think it will be easier to code against once all this work is done.


I’m in a Code Crunch, but Still Fortunate

CodeI am a .NET developer for a large State Government entity. In this role, I was tasked to create a new system with both an internal application and a public website. The public website would be for the outside world to view the information being processed in the internal application. Many outside sources have been pushing for this system for years, long before I started working here. I was the chosen one when I came onboard, to develop this system once and for all and get it into production. There was one catch, ok, maybe more than one. The deadline was yesterday. How familiar does that sound? The other catch, no one wanted to take lead on this project. As the new developer I couldn’t take lead. I don’t even know their business process. Of course, they don’t even know their business process so they couldn’t even begin to tell me what they needed from the system.

It’s definitely been a challenge. I’ve currently got the internal application in production (albeit in “test” capacity), so they can start using it and adding data. Thankfully, it was stressed that it is an unstable release and the data could all disappear. That was the risk they were willing to take to get this thing off the ground. The website will be partially launched in the next few weeks. Then I can hopefully get some of the bugs worked out of the internal app while working on the 2nd part of the website.

I am fortunate though. There is a light in all this madness. With all these stressors, my supervisors completely understand the pressure being put on me to have everything working now with no input from the people who will be using the system or the people who want delivery. I’m just expected to whip something up out of thin air. They do know the deadlines are unreasonable for one programmer that isn’t getting any input or direction.

This understanding makes it all seem not so bad. To have that backing from my supervisors is a Godsend, really. So when I don’t produce results as fast as TPTB want them, it’s not on my shoulders. They know I’m working as fast as I can while also trying to be as thorough and as good as I can. Too fast can be sloppy and result in a really bad situation.

I am truly grateful to have supervisors  who understand…many do not as they are not developers themselves. Some of mine aren’t either, they are engineers, or business folk. But they understand and that makes my working environment so much better to have them on my side. I’m very lucky to be working where I am.

This Spring I'll be Outdoors

We just got our daughter a play set for the backyard. Two swings, a see-saw, a rock wall, a slide and monkey bars. It is set up right next to her playhouse. I see many summer weekends being spent in our backyard this year. I am so excited, because now that she’s 4, she definitely needs to spend more time outside rather than sitting in front of the tv. This is the perfect way for her to do that, because I don’t have to drive and take her to some big, open, playground where I’m constantly paranoid she’ll disappear.

This is so much better. I can get stuff done at home while she plays in the backyard. I can sit out there and spin, or knit, or read a book and not worry. I don’t have to have eyes on her every second that she’s out there playing. We don’t have to schedule playtime at the park, because she can just walk outside. I can still see her while I’m cooking dinner, or just cleaning up the kitchen.

For her, it’s awesome fun. For me, it’s freedom to let her play and less worrying for me. Good all around.

Powered by Plinky

Good Parent, Bad Parent

For the longest time my daughter was so clingy to me, she wanted nothing to do with my husband. She refused to give him hugs, cuddles or good-night kisses. When there was something she needed, daddy couldn’t help. Mommy had to be the one. I felt bad and tried to encourage her to let daddy help. But I also knew that it was a phase and eventually she would want him instead of me.

I think that it is slowing happening. She cries when he leaves for work. She gets super upset when she doesn’t wake up in time to give him a hug and a kiss before he leaves (he has to be at work at 6am). She wants daddy to help with stuff. And I’m totally fine with all that. What really bothers me though is that she has started refusing to do what I tell her. This is very frustrating. Bedtime is a nightmare because she just doesn’t listen, unless her daddy gets involved. But it’s not just bedtime. It’s everything. She even hits me when she gets mad. I’m trying to hard to have more patience and not yell, but sometimes it’s so hard when she just completely ignores me.

This too shall pass, but I feel like I’m now the bad parent, when not too long ago, I was the good parent who could do no wrong.