“The member with identity ‘Result’ does not exist in the metadata collection.
Parameter name: identity”
If you have stumbled across this error when trying to perform a transaction against your DB or any other action via your entity layer. If it is indeed a Microsoft SQL Database or any other database I would highly recommend you disable triggers on the affected tables and re run your test.
This error is the entity layer running home to its default error when either the error cannot be translated or the what ever is being returned from the transaction cannot be understood.
So if you stumble across this error, its because the entity layer is performing an operation that is causing a secondary separate operation which is where the underlying error is kicking back from, either because an error was raised or because the return is in an unexpected format.
What is the VIES ?
It is an electronic means of transmitting information relating to VAT-registration (= validity of VAT-numbers) of companies registered in EU. Furthermore, information relating to (tax exempt) intra-Community supplies between Member States’ administrations is also transmitted via VIES
The Taxation and Custom Union has provided us developers a nice little webservice to use for validating VAT numbers realtime.
Ok so now i will demonstrate how to use this in your Visual Studio based application
If you have Visual Studio 2010, and your building a web app, in solution explorer right click the web app root node and you should see “Add Web Reference”, this will present you with the “Add Web Reference” dialog box
Paste the above web reference link into the “URL” and hit the “GO” green arrow
Now Hit “Add Reference” and Visual Studio creates the Web Server Proxy and Wrapper Class.
Ok so now your project has the reference lets see how to use it
On your page that you wish to validate a vat number you should do the following
1. Collect a valid 2 character country code from the User
2. Collect a valid vat number from the User
3. Perform the needed filter on both of these values prior to envoking the webservice
4. Verify the return from the service and take action
First off you will need to import the reference into your page. For ease I use asp.net vb, C# will be similar and there are plenty of converters out there to see the code in c#
Visual Basic .NET
now your ready to use the reference
For this example we will be supplying country code and VAT number only. There are various other methods available but this suited me so its the only demo you will be getting.
1.The country code must be valid
2. The VAT number must contain no spaces and only be numerical numbers
3. We pass the validation boolean as a byref, if you also wanted to see what the company name and address the EU have on file for the company the webservice verified, you can pass two strings “Name” and “address” byref and view the content upon return.
This is how i do it
Visual Basic .NET
''' Calls the Taxation Customs Union web service to validate the vat number
''' This works in most cases and is the best way to validate
''' VAT Information Exchange System (VIES)
'get the country code of this User (they are logged in so we can find it)
My particular app verifies the value of IsValid in the calling function, how you validate the values is up to you, on asuccessful return the value will be true and the byref Name and Add will contain the registered company name and address.
Information Technology, Life, Interesting Stumbles, Servers, Configuration, Topology, Security, Best Practices, Developing, Fire Fighting, Problem solving, Visual Studio 2005 – 2015 .NET 1.1 – 4.5, jQuery, JSON & much much more