I got this error. I got no information on the internet as to how to get around it…
3 hours earlier:
I wanted to create a sequence diagram from the code I have already written. Visual Studio 2010 comes with the sequence diagram feature. I decided heck why not use it. It creates some really cool sequence diagrams. I opened the same project in Visual Studio 2010, created the sequence diagram, closed the project. Went for a smoke.
30 minutes earlier:
My test cases won’t run. the error I get is “Error loading xxx.vsmdi: D:\Projects\xxx\xxx.vsmdi” looked here, looked there looked everywhere. But didn’t look in the place I should have been looking.
10 minutes earlier:
I built the test project. I got an error. “Project file contains ToolsVersion="4.0", which is not supported by this version of MSBuild. Treating the project as if it had ToolsVersion="3.5".”
Well I should have been looking at this 30 minutes ago. I went to the test projects Properties, went to TargetFramework and checked. it was not selected at all. I selected Framework 3.5.
After this all I had to do was close the project and open it and then run all my tests in the solution.
They were all still green. Love it when that happens…!!
So you need to read the entire UML book in 20 minutes. What do you do? These are the excerpts from the Unified Modeling Language Reference Manual I was reading and thought I could summarize for a quick refresh.

Aggregation and composition:

Generalization:

Kinds of dependencies:


Use case diagram:

Kinds of Use Case relationships:








Activity Diagram:


Sequence diagrams and Activation:



Component Diagram:

Deployment Diagram:

Packages and relationships:

Well I was running my test cases today and suddenly all my white spaces turned into dots. Yes it creeped the heck out of me.
First thing I thought was to get rid of that. Went to Tools and Options and couldn’t find the setting that would get rid of the nauseating dots.
So I started trying all the shortcut keys. But initially nothing worked. Now Ctrl + R + D happens to be a combination that debugs the tests in context. So I thought the key pattern that enables and disables the visible whitespace feature has to be similar.
Discovery: Ctrl + E + S
This evening I heard someone say that Left Outer Joins are not possible in Entity Framework or perhaps Left Outer Joins are possible, but they bring in all the data and then filter out the right table.
I felt an urge to argue, but I resisted. I thought I would investigate before I waste time. I came up with some articles pretty quickly.
- Left Outer Join in LINQ
- Left Outer Join using Inverse Navigation Property
- DefiningQuery Element
- Left Outer Join in LINQ to SQL
- LINQ to Entities with Multiple Left Outer Joins
I am sure these should resolve all questions related to Left Outer Joins.
Now about the performance and the question about how the data is brought, I am pretty sure we can prove that LINQ Queries all support deferred execution. But we can always prove that using the SQL Query Profiler.
Hope this helps.
Well I was asked this question once. “What is a singleton design pattern and why should I use it? Why not use a static class instead?”
And it was quite surprising how it went. I said that Singleton is used when you need to maintain state. Static classes are used when you want to club together a bunch of stateless methods that do something irrespective of which instance calls these methods. Math class is a good example.
So he asked me, can I not maintain state in a static class? So I said if you want to instantiate something in a static class how would
you do it? And surprisingly he told me that he would do it in a static constructor. I asked him, is it possible to instantiate anything in the static constructor or even declare an instance type in a static class? And he asked me is it not possible? I said it is not as far as I know and he asked me if I am sure.
Now the way the questions were asked about this subject, I was quite surprised. The interviewer looked quite convinced that instance types can be declared in a static class. I am surprised how he was allowed to take the interview in the first place. Or was he checking my confidence?
I wonder.
When faced with the dilemma that what if I wanted to insert something and before I actually saved the changes into a persistent storage (database) by calling SaveAllChanges() method on the data context, I wanted to do a select, and also I wanted to make sure that this select is done on the just inserted objects, what should I be doing?
Well generally we write a generic method that gets all the records for a generic object. it looks like this:
IQueryable<T> result = null; string type = typeof(T).Name; //ObjectQuery query = entities.CreateQuery<T>(type); ObjectQuery query = Context.CreateQuery<T>(type); result = (
IQueryable<T>)query; return result; This will only query into the database. So if you have just recently inserted some records, but haven't yet committed them, they won’t appear in the results.
However, if we provide another method (an overload perhaps) that handles local objects, this would be possible. When I say local objects, I mean objects that have been inserted into the Object Context and yet not been persisted into the database. this method would look something like this:
IQueryable
<T> result = null; string type = typeof(T).Name; return from stateEntry in context.ObjectStateManager.GetObjectStateEntries(EntityState.Added | EntityState.Modified | EntityState.Unchanged) where stateEntry.Entity != null && stateEntry.EntitySet.Name == type select stateEntry.Entity as T; This way we give the option to the user of the API to choose which kind of select he wants to fire. A local one or one on the database.
Back during the RMI days, we used to generate skeleton (henceforth referred to as skel or skels) and stubs for all long range service communications… Yes… WCF has its roots there and perhaps further into the past…! Details available here.
Looking at it from an architectural perspective, the data contracts were designed in such a way that the changes are minimal because every change in the stub would have to trickle down all the way to the client.
We have come a long now and Service Oriented Architecture is something that must be considered in any well behaved and decent enterprise application. In an environment such as this, I wouldn’t ever suggest having client dependencies on any 7 letter word starting with an ‘s’ ending with an ‘e’ and having ‘ervic’ in between.
We should think about providing all client apps independence so that any server / database / service changes do not affect the client… to a great extent…
Now there is a big discussion going on across the Internet about whether business objects should be separately created or should we treat EF entities as business objects. After all that’s what they are. Business Objects carry data from the client to the server and back and that’s what EF entities do… really really well… with all those amazing features such as state management, change tracking, yadda yadda… “straight out of the box” as they call it…
“Well couldn’t I agree more. But wait… entities are created from the database right…? using the EF Designer…?”
“Yes… and you could create in a number of other ways…”
“Well… doesn’t that mean that the design of my business objects would be dictated by the database design?”
“Of course not… Hell no… it is not necessary that you have to import all the entities from the database straight… of course you have the choice to customize them… manually…”
“Hmm… That’s nice… so now I can create my business objects with inheritance and everything just as I want them to and then map it to my database… True Object Relational Mapping…”
“Umm… Wait… did you say Inheritance… well you have that exception… you see the entities are already inherited from ObjectContext. And since there is no true multiple inheritance… you have that constraint… At least not in Framework 3.5… I don’t know if that would be available in Framework 4.0 either…”
“Ok… so what if the structure of the entities change…”
“Well all you have to do is regenerate the proxies and you are done…”
“Umm… new proxies…? Do you mean a change in the data contract…? what if I am not consuming the change… Like I have first name and last name in one of my screen and I don’t need the middle name although, i need it somewhere in the server… Do I still have to break the data contract…?”
“Err… Yes…”
Precisely why you should not be using Custom Entities or EF entities as business objects. You might be able to solve all your problems using partial classes and all code customizations… But end of the day, you are breaking the dependency rule.
There’s a reason why they call it a Data Contract.
The solution would be to create a separate business objects layer and then map your business objects with the EF entities. There are a couple of really smart implementations available. One of them could be implementing the Observer Design Pattern so any change could be tracked and reacted to.
Speaking of which I just discovered a good video in which Eric Meijer talks about the Reactive Framework. Definitely worth a watch.
“Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects”
You are sitting at home, working on your work laptop, you have a deadline to meet, give an entity relationship diagram for your technical specification document for the module you are working on. So you decide to create a temporary database on your machine itself and then generate a database diagram.
You try to create the diagram and this is the error message you get. You go check the “Files” page of the database properties and it rightly contains your office alias. you refresh it and it still doesn’t work. You think it is some security / privilege issue. You check the Securities tab and everything is in order. It still doesn’t work.
You distinctly remember it to be working when you tried it yesterday at work. It just doesn’t budge now. Wonder what’s wrong.
The problem is you were at work yesterday which you are not now. Meaning you are not on the corporate network and you don’t have the Domain Server available. SQL Server tries to validate your credentials with the Domain Server. It doesn’t find it. If you have any means to get on to your corporate network, like RAS, perhaps, then you should and you will see it will work like magic.
There are times when you have to work with XML. Yes those dreadful times. Specially the times when you get data as XML. And not just master data you sometimes get transactional data in XML. Think about it. How much worse can it get if you had to work with transactional data, and sync it with the database?
I am working on something in that direction. Although I haven’t finalized the approach yet, but it would involve creating an xsd, converting the xsd into datasets and then moving the data into the database.
But have you wondered how you would create a database that is similar to the xsd? Of course you won’t hand code it? Smart developers use smart tools. I found this cool tool that does it all for me. it is called XSD2DB. Isn’t that an intuitive name? It is available download for here.
This is not a problem that I feel you would encounter on a regular basis. I think I had a unique problem because of which I encountered this one. When you install an operating system it allows you to create a profile. Now I installed the machine at home. Which means I was not on the corpnet of Microsoft which means I could not log on to the domain. So when I created a profile named after my alias, it was considered as a local profile and not a domain profile. And a folder was created under “C:\Users” with my alias name.
I am not sure if this makes any sense or not, but hey, I am a software program writer not a network administrator. So please excuse my jargon. Anyway, when I actually logged on to the domain with my brand new operating system the next day, a new profile had to be created for the domain. Now since there was a folder already with my alias name in “C:\Users” the brand new operating system create a brand new profile with in the format <alias.domain> so now there was a “.” in my profile directory name.
What happens is this “.” sometimes creates problems in installing certain software. I got the error message saying “There is an invalid character in the directory path of My Documents”. I checked the path and could find only one anomaly. And no points (“.”) for guessing what.
So I decided I will rename the profile directory. I straight away went to the directory and though I would rename it to something else. of course it wouldn’t let you. So I thought I would log on as a local administrator and then do it. Also I made sure that I start windows in safe mode.
After Logging on I backup my documents, and delete the profile and assume that the next time I log on, it will automatically create the new directory for me. Guess what… Not that easy…
So after a long research I found out that there are registry entries out of which windows reads the location of the profile directory. So if it doesn’t find the directory at the specified location, it creates a temporary directory and logs you on with a temporary profile. And after the log on is complete, it gives you that message.
So here is what you do to save your life. Please do this only if you have already deleted your profile and did not take backup. If you are doing your research before you have messed with your machine, please skip these steps and refer below.
-
Log on with local administrator account, preferably in safe mode. To boot the machine in safe mode, Click F8 during boot.
-
Click Start + Run and type in regedit and then Enter.
-
Open HKEY_LOCAL_MACHINE
-
Open Software
-
Open Microsoft
-
Open Windows NT
-
Open Current Version
-
Open ProfileList
-
Here you will see keys that belong to each profile. To find your problematic profile navigate to each key and refer to the ProfileImagePath entry on the right hand side.
-
Once you find your problematic profile, just delete the key. This means delete the folder on the left hand side tree view that contains your alias in the ProfileImagePath entry.
-
Restart machine.
There is another way you can actually backup your profile and create a new one.
Click on “Start”, Right click “Computer” and go to “properties”
Click on “Change Settings”
Go to the “Advanced” tab and click on User Profiles “Settings” button
“Change type” will allow you to change your profile type between Roaming and Local Profiles
“Delete” will delete that profile. Including the registry entries and everything.
“Copy To” will back up your profile. It is always advisable to backup your profile from here rather than from anywhere else. Your profile contains more than you can see. Hidden Files, System Files, etc. This takes care of everything in a safe manner.
Hope this helps.
More Posts
Next page »