FunctionImport is not mapped to StoredProc

Somehow I fell from the “happy path” creation of a stored procedure and the Entity Framework. I had to make changes to a stored procedure and it got deleted from the Entity Data Model Xml file (*.edmx) resulting in the following error message when trying to compile the project:

An error occurred while preparing the command definition. See the inner exception for details.

Inner exception:
{“The specified FunctionImport is not mapped to a store function and cannot be executed.”}

There is an easy solution to fix that error. First open your edmx file and right click on the model that owns the stored procedure. Click Add then select “Add Function Import”.

Add the same Function Import name that is used in your Context file (if like me, the method was already created but messed up, otherwise is all new and it will be recreared anyways). Select the Stored Procedure Name that you are trying to fix. Choose the Entities and click OK. A new window might pop up “Verify that the FunctionImport name is unique”.

If that is the case, and you get the “Verify that the FunctionImport name is unique” window popup, do the following: Open your *.edmx file and right click over the model you want to update. Select “Show in Model Browser”. Now the Model Browser window opens up. Go to: {myProject}.DataModel > EntityContainer: {somethingEntities} > Function Imports. The function import causing the problem should be there, just delete it and save the *.edmx file.

Try to add the Function Import again. Voila! no issues this time. Save the *.edmx file and recreate the context file (by making a simple non-invasive change like adding a space to the {myProject} file). make sure the new method:

public virtual ObjectResult<MyEntity> <MyEntity>_NameoftheSP(parametets) is present in your Context file.

After that I get no more errors at build time or runtime.

All of the credit for this BlogPost goes to:

I am just reposting here so that I never lose it. Thanks to:

Visual Studio Lost Toolbox

Every once in a while I lose my toolbox. I am the king of copy and past, saving scriplets and reusing the template of a code piece so I do not have to remember or need to retype stuff I use over and over again. I typically have 20-30 recenly and useful scripts that make my life easier.

I lose this “Toolbox” at least 3-4 times a year. it is not just vs 2013, it’s been going on for some time. the file get’s reset and voila, a clean toolbox. Shit. There is no backup made by VS – you need to manually do this yourself. You also to remember to back them up. The file you need is located at:

C:\Users\[Your_user_name]\Documents\Visual Studio 2013\Settings\CurrentSettings.vssettings

Copy it asap and save it for later. Wen your toolbox disappears, close VS and just delete the CurrentSettings.vssettings and rename your saved one back to this name. Open VS back up and there it is.

Save often, especially after some great code piece updates. hope this helps others.

What value does a URL have

If you’ve been in the web and website business for as long as I have, or if you’ve ever come up with a great product idea, or company name, only to find out your .com domain name is taken, you are not alone. It is down right depressing in many instances because more often than not it is not a real website, not a legit company, not a great product, but a cyber squatter.

A Valuable URL?

A Valuable URL?

Many companies have been built on cyber squatting, and many businesses operate right now buying and selling URLs. They grab then when they expire, or they registered a bunch a long time ago because they thought someone in the future might want them and might pay a premium for them.

I have been party to a purchase of a domain name that was 4 figures (over $3000 – it was and is a great domain) and I have owned a few domains where people were looking to purchase from me (I did not sell).

A great find…

What is the true value of a great URL?

Well the top URLs that sold (which is a great indicator of value) starts with for $13M and for $11M. was number 4 at $9.5M from a listing of the ‘all time biggest URL sales’.

A notable one (non-smut related) is which was actually number 5 at $8.5M. I bet someone right now probably feels like they could have got a bit more out of facebook for the url?  But hey, not bad for a $15.00 investment.

Sometimes the value is in the name, like google or yahoo, which meant nothing before the company started but now a re mega-valued properties toed to the company’s value. Others are generic terms like the above – great name for sure. But what about the rest of us?

What happened to us, is typical. When we re-branded our training company and found that (owned by NIIT Ltd.) was already taken. We had to go back to the whois drawing board.

We actually tried to do one a little better, because the company name is Think Training, well guess what – is also taken. Doh!

We ended up changing our name to Think Business Training. The URL was available and our Canadian version of a website is doing us proud, but was not our first choice, not our second choice, alas. But what about a really great URL?  Why cant we all have a great one?

Maybe we can…you just have to look a little farther afield. Please drop us a line and tell us your opinion on this topic. I would love to hear your story.

Forms Authentication

asp-net-logoAs a self taught programmer (MS VB for me pls.) every once in a while I come across a technology late that would simplify my application development immensely.  While the MS site (MSDN, etc.) always makes things way too complicated for my simple programming skills, there is usually a blog, or post that simplifies things so someone like me can implement it simply and successfully.

For me the post here on forms authentication got me started in the right direction. While you still need to know what it does, and how it works, with a few simple code pieces you can have your whole application secured by the .net infrastructure.

Entity Framework 5.0 for VB.Net – Good enough for me

Our soon to be open source CRM versino 5 is using the Entity Framework 5.0 for data connection. It is FAST, easy to wire up and has some amazing time saving features.  I have yet to find a data/webUI need yet that I cannot do with EF5 and MSSQL.  I am using more stored procs than ever, but the elegance of calling them with EF5 makes them a treat to use.  I used to not appreciate them, as I could do a lot in code, and never really ran out of or needed more resources.

Here  is a Step-By-Step of how I start my projects with VS2012/13 and EF5.

Part I

In VS >>File >> New Website -VB Template and an ASP.Net Empty Website

Choose and appropriate location to start (filesystem) – I like to have my sites start at D:\clients\<Client or Project Name>\wwwRoot\

start hereThis is a blank site so add an Images folder and a Data folder, and a default.aspx file to get started. In between the Div tags add “Hello World!” then hit F5 to see if the app compiles and runs.

You should see a localhost website run in your default browser with the words Hello World! in the top left.

If all is OK, proceed.

Part II

In VS >>Tools >> Library Package Manager >> Package Manager Console
Run >> install-package entityframework -version

If ok proceed.

Part III

This part makes the assumption you have a database ready to do some work in. If not please refer to my other tutorials to create the basic CRM application repository (MS SQL for me).

Right Click on the DATA folder >> Add >> Add New Item (CTRL-Shift-A) data

Choose ADO.Net Entity Data Model >> give it a useful name (CRM.edmx)

>> Generate From Database, then next

crmEntityCreate a new connection to your local (or web hosted) server, save the Connection String to the Database, and give the the entity connection a useful name such as crmEntites.


Choose the tables you wish to connect to.  Give the model name a useful name: crmModel is what I use.