Recently I got this error when I try to update table using Entity framework 5.
Cause :Reason for that is the target table does not have the primary key.So need to add the primary key to the target table.
Happy coding
Recently I got this error when I try to update table using Entity framework 5.
Cause :Reason for that is the target table does not have the primary key.So need to add the primary key to the target table.
Happy coding
recently I have used below query to get some filterded details from my table.
dbContext.ttable.Where(r => string.IsNullOrWhiteSpace(r.field))
but when I try to run above code snipped I got
“LINQ to Entities does not recognize the method 'Boolean IsNullOrWhiteSpace(System.String)' method, and this method cannot be translated into a store expression."”
after few minutes searching found the reason for that.
My query return type is IQueryable<ttable>.So this type is optimized to the deliver an optimized query.In this context all C# methods are not supported.There for I have to change the query like this and then it works
dbContext.table.where.(!(b.field == null || r. b.field.Trim() == ""))
I install entity framework 5 to my 2012 project and create the EDMX using the already created Database schema.but project build was failed mentioning above error.so I search and found below solution.
Step 1: Go to below LOcation
Step 2 :
Open EF.Utility.CS.ttinclude file and remove code part from it and save .
“<#@ CleanupBehavior Processor="T4VSHost" CleanupAfterProcessingTemplate="true" #>”
I have entity class which was generated from entity framework 5 db first approach.So I needed to add another property to this class because I need to do few track the instance state for some reason.
There are few ways to this in Entity framework.
Approach 1 :Because entity class is partial can created another class same, same name space and add the new property
Approach 2 : Add new property to directly to the entity and marked its as not mapped entity using NotMapped attribute.
In my scenario I used approach 2.
public string Warehouse { get; set; }
public string ProductGroup { get; set; }
public string RolPackageNo { get; set; }
public virtual ICollection<Tab_AODLines> Tab_AODLines { get; set; }
public virtual ICollection<Tab_PickListLines> Tab_PickListLines { get; set; }
public virtual ICollection<Tab_SplitLines> Tab_SplitLines { get; set; }
//new property
[NotMapped]
public bool HasChanged { get; set; }
Of course you'll need to have these two using statements at the top your Entity Framework class to get things to compile.
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
Bingoooooo
Even though Microsoft Visio 2010 shipped with reverse engineering facility its does not have the capability of forward engineering .But there is a addin in CodePlex which gives the forward engineer capability to the Visio.Somehow Microsoft decided not to include this feature in 2010 version of Visio.
download and install above addin from below link :
After install reopen the Visio.then you will be able to see new tab called Forward Engineer.
Validate Data Model :This will validate your data model and if any error found displays in the output window
Forward Engineer :If there are no errors after the validation you can generate the query for the designed schema.
Add Service meda data information to the config file.
<behavior name="serviceBahbiour">
<serviceMetadata httpGetEnabled="false"/>
</behavior>
I have hosted wcf service in Console Application and run ,Then my app prompt below exception.
Solution for this is running the the CosoleApp/Visual Studio in Admin Mode
I am load testing a WCF project using VS2010 load testing manager , that uses an app.config file to load configuration properties. But the problem is load test application itself does not have an app.config file. there for what I have done is add the .config
file to the ny load testing project and its works charmly
Recently I have create WCF service and hosted in IIS 7.5 under was.
Then I investigate the reason and found the reason.In order to over come this issue we need to have both http,net.tcp protocols in hosted web application advanced settings under Behavior section.
Recently I have created wcf service which is on NetTCPBinding and hosted in WAS.But when I try to create proxy using WCFtestClient its always failed prompting this error.
The reason for this is the host sent a reset signal, instead of an ack when the client tried to connect. It is therefore not a problem in the code. Either there is a firewall blocking the connection or the process that is hosting the service is not listening on that port.
After doing above two steps its works
Recently when I try to deploy my web application to newly setup windows server, in the IIS it doesn’t listed the windows authentication option under authentication
In order to have listed windows authentication you need to install it by going to the Server Manager and checking Windows Authentication Check box
Server Manager—>web Service--->Add Role Service
Note : - In this machine already installed the Windows authentication .other wise check box will be enabled.
recently I got this error when I deploy my asp .net application to the IIS.Reason for is that by default iis 7 didn’t allow ISAPI and CGI.There fore you need to allow those properties manually by using actions pane