Build failed due to validation errors - wcf

I am developing windows phone app. I am using Linq to Sql with WCF application. I have drag and drop the tables and store procedure in Model.dbml. I am stuck with following error.
Error 1 Build failed due to validation errors in E:\path\Model.dbml. Open the file and resolve the issues in the Error List, then try rebuilding the project.
I am not getting about this error. How can I solve this error?

.dbml is related to Linq to Sql Classes. It's not relevant to ADO.NET or Windows Phone and for sure it's fully supported in WCF and often the recommanded approach.
Linq to Sql uses a database-first approach where you have the database and model your classes after the DB schema. It's a completely client side thing : a set of information about your tables in the database and how you're going to map them to .NET objects. The DBML file is mapping that defines your classes based on your database schema.
DBML Validation is a specific task in the Build process.
To see the error, open the dbml file (desginer) and check Error List Tab. It's a compilation error and not a runtime exception.

Frist clean your project and next build it.
I had this problem.

Related

Sql Exception - Trying to attach a database file, but using the wrong path?

I've got an MVC project for an interview that was using a mock database. I'm trying to get it to to use an actual database connection now and use Entity Framework.
To do this, I've added a database file to my solution, and have a class that derives from DbContext. My problem is that when my app tries to access the Db context, I'm getting this error:
Some context for this: I have the following projects in my solution:
Data <- The actual location of the .mdf file
Logic
Services
Tests
Web <- My MVC project
Based on the error, it looks like it's trying to access the mdf file from within the App_Data folder of the Web project instead of the Data project, but I don't know where I tell my solution the actual location of the database file .
My database file does seem to be set up correctly and working overall, though. I'm able to do migrations and update the db via Entity Framework. It's just at runtime, I get that error when my Service object tries to access it

SSIS Error: VS_NEEDSNEWMETADATA

I'm currently updating all of our ETLs using Visual Studio 2015 (made in BIDS 2008) and redeploying them to a new reporting server running on SQL Server 2016 (originally 2008R2).
While updating one of the ETLs and trying to run on the new server I got this error:
The package execution failed. The step failed.
Sometimes it also produces this error:
Source: Load Fact Table SSIS.Pipeline Description: "Copy To Fact
Table" failed validation and returned validation status
"VS_NEEDSNEWMETADATA".
I've tried deleting and re-adding the OLEDB Destination, connection strings and opened up the column mappings to refresh the meta data. I also recreated the whole data flow task but I'm still getting the same error.
The package runs fine on my local machine.
UPDATE:
I started taking the package apart and running only pieces of it to try and narrow down which part was failing. It seemed to be failing on loading into the staging table but I couldn't find out why.
I eventually decided to just try and re-create the whole thing. After re-creating the entire package, still no luck. The picture below is from the event viewer on the server itself but it didn't give me any new information.
Package error from event viewer
I have tried all the solutions provided above and the other sites. Nothing worked.
I got a suggestion from my friend Which worked for me.
Here are the steps:
Right click on the Source/Target Data flow component.
Go to Advanced Editor -> Component Properties
Find ValidateExternalMetadata and set it to False.
Try your luck. This is a pathetic issue and left me clueless for 2 days.
I finally found the issue and here's how I did it.
Because the error messages I was getting from SSMS weren't very insightful I first opened up my remote desktop and logged into the server. Then I went to Administrative Tools>Event Viewer and then Windows Logs>Application to see if the failed event would provide greater detail.
It didn't give me much still.
The next step I took was to run the package from the command line because the messages should be more verbose. Opened up cmd, changed directory to the one my package was in and then...
DTEXEC /FILE YourPackageName.dtsx
Finally, the error message here showed a missing column in the tables the package was trying to write to. I added those columns and voila!
As stated in comments,
if it runs ok in your development environment, then the problem isn't with the package, it's with the scheduled job on the server. Try recreating that.
If that doesn't work,
It seems like the server has a cached instance of the package it's using instead of the updated one. Try renaming your package and creating a new job with the new package name and see if that works.
If that doesn't work,
all I can recommend at that point is to cut the package down until it succeeds, then add the next step that fails.
Sounds like from your solution the development environment is more forgiving of schema updates than the deployed solution. Glad you were able to resolve, eliminating clutter helps.
I had the same problem and my issue was a difference between two environments, the same field in the same table once was written with a capital and once not. So the name was the same, but with this small difference (e.g. isActive vs IsActive).
This came from a refactoring effort, where we used VS database publish that did not updated the field name.
Have you tried deleting and re-creating the source? When I get this I can generally modify OK any object that has the error but have to delete and rebuild the paths between them, however sometimes I have to delete everything in the data flow and re-create it.
A Proxy for SSIS Package Execution should be created under the SQL Server Agent. You should then change your job step (or steps) to Run As the Proxy you've created.
I had your same problem some time ago and the proxy fixed it.
Forgive me if you've already tried this.
It is very common to get that message when 2 columns in the source file are being inserted into the same field of the table.
i.e.
My text file has twice "neighborhood" (same label for different columns) and my table has "neighborhood" and "neighborhoodb" (notice the "b" at the end). The import will try to import both text columns into the field "neighborhood" and ignore the "neighborhoodb" field, it will fail with the "VS_NEEDSNEWMETADATA" error.
Re-creating the job worked for me. Some cached version of the job may have been causing the VS_NEEDSNEWMETADATA error. The package was executing correctly but it was failing, when it was executed by an agent job.
This ended up being a permissions issue for me. The OLE DB Source was using a stored procedure that selected from a SQL view. This view joined to a table in another database and unfortunately the proxy account the SQL Agent job step was running the package under did not have SELECT permission to the table in that database. This is why the package ran fine in Visual Studio but not from a job when deployed to the server. I found the root cause of the error by taking the SELECT statement out of the stored procedure and putting it directly in the Source Query box of the OLE DB Source control which caused it to finally return the 'SELECT permission denied' error message. This error was apparently hidden from SSIS since the proxy account DID have execute permission on the stored procedure.
It works for me after changing the ValidateExternalMetadata to false. I was transferring the data from MSSQL database to MySQL database. Changed "ADO NET Destination".
You may need to strongly type your Source Query.
Example:
If your DestinationDB has a FullName field Nvarchar(255)
and in your source query you have
select firstname + lastname as FullName from...
Try this:
Select CONVERT(NVARCHAR(255),firstname + lastname) as Fullname from...
So if you are going from db to db and both are nvarchar(255) I don't have this issue, but if you are concatenating fields in your query specify the data type and length.
This error can also occur when an entire SSIS project needs to be redeployed rather than just one of the packages (for VS versions that allow deployment of a single package in a multi-package project), particularly when a project connection has been changed or added. For example, if you've added or removed columns from a flat-file project connection. In that case, you need to deploy the entire project to push out the updated project connection properties. This can be true even if the project only has one package in it. In VS Solution Explorer, rather than click on the package name to deploy, select the bolded project name at the top, and then click deploy.

Failed to find or load the registered .Net Framework Data Provider (VS2005)

I am editing some existing code, and as part of the changes I need to add a column to each of two datasets (.xsd in Visual Studio Solution Explorer).
One worked fine - open the designer, right-click, add column.
The second gives the following error:
"Failed to add column. Failed to find or load the registered .Net Framework Data Provider."
As these are both in the same project, I'm confused as to why this one is failing when the other is not.
The only difference I can think of, is that the one that works is selecting from the database directly (SELECT ... FROM TABLENAME); whereas the one that fails is selecting from a database function (SELECT ... FROM dbo.FunctionName(#param) AS ALIASNAME)
Wherever I've looked, people suggest it's an error with the .settings / .config files; but because one works and one fails, I can't see how this can be an issue with references?
This is in a standard vb project in VS2005, that compiles to a DLL - so it's not asp.net.
--Edit--
Right-click, Preview Data also gives the same error.
--Edit2--
When I try and Add a DataSource, I get the following error:
This SQL Server version (10.50) is not supported.
I have SQL Server 2005, and SQL Server 2008 R2 installed, both with latest service packs.
I tried two things simultaneously, and one of them worked:
I installed the following patch from Microsoft: https://www.microsoft.com/en-us/download/confirmation.aspx?id=15680
I rearranged my machine.config file (SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config), so that in the DbProviderFactories section the one I am using is at the top of the list.

No MigrationSqlGenerator found for provider 'Oracle.ManagedDataAccess.Client'

I am using Code first approach for oracle with Entity framework 5.0.0.0.
i am getting below error during migration
No MigrationSqlGenerator found for provider 'Oracle.ManagedDataAccess.Client'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators.
i have added Oracle.ManagedDataAccess, Version=4.121.1.0 in solution and able to execute
Enable-Migrations and add-migration Initial in package manage console but when i am going to excute update-database command then getting above error message and database and table is not created in oracle 11g.please let me know what should be do.it's correct dll or we need to add additional changes.

Does nHibernate allow drag and drop automatic class creation like linq to sql?

Just a basic question. Learning Linq to SQL and some nHibernate. I am using the mvc tutorial and they drag and drop tables onto the visual studio designer to create the classes and wire up everything.
When I experimented with nHibernate I had to do lots with xml files. Does nHibernate have anything that is "easy" like Linq to SQL or is this drag and drop for Linq to SQL so basic that when I want to do something "real" it won't matter that Visual Studio does this for me (at this basic level)? In other words, the further I go with Linq to SQL, I'll eventually have to handle config files like I do with nHibernate.
Look at Castle's ActiveRecord framework. It replaces the use of XML config files with the use of Attributes directly on the class/property declaration. Also, a tool called ActiveWriter integrates with Visual Studio and allows connecting to a data source and generating the object model!
There is no "native" support like you see with LINQ to SQL. However, there are third party add-ins that will allow you to do something similar with nHibernate. My favorite is this one:
http://sourceforge.net/projects/nhibernateaddin
To use it:
Create a data connection to a
database that contains the structure
you are going to code against (your
development database).
Add a new NHibernate plug-in item
(via add new item) to your project
that will contain you domain objects.
In the property window add the data
connection string from the data
connection you just created (this
isn't automated yet).
Finally, you drag and drop your tables
from your data connection to the
NHibernate plug-in object and when
saved your mapping files and you
domain objects are generated. To use
it you create a data connection to a
database that contains the structure
you are going to code against (your
development database).