i write a client server application. If the server request data from EF6 there is no problem and no exception. If the client asks over WFC data from the EF6 there is a provider not found exception. My database is a MS SQL Server 2017. CLient and Server have the same debug folder.
Exception over WFC:
"No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information."
Server App.config
<?xml version="1.0" encoding="utf-8"?>
Integrated Security=True;Database=PeddTax;MultipleActiveResultSets=True"/>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<services>
<service name="PeddTaxServer.Communication.UserService">
<endpoint address="http://localhost:6060/wcf/UserService" binding="basicHttpBinding"
bindingConfiguration="" name="UserServiceEndpoint" contract="PeddTax.Communication.Interfaces.IUserService" />
</service>
</services>
</system.serviceModel>
Client App.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
</startup>
<system.serviceModel>
<client>
<endpoint address="http://localhost:6060/wcf/UserService"
binding="basicHttpBinding" bindingConfiguration=""
contract="PeddTax.Communication.Interfaces.IUserService"
name="UserServiceEndpoint" kind="" endpointConfiguration="" />
</client>
</system.serviceModel>
<system.web>
<compilation debug="true" />
</system.web>
</configuration>
IUserInterface for WFC
[ServiceContract]
public interface IUserService
{
[OperationContract]
void AddUser(User user);
[OperationContract]
void UpdateUser(User user);
[OperationContract]
User GetUser(Guid id);
[OperationContract]
List<User> GetUsers();
[OperationContract]
void DeleteUser(User user);
}
UserService for WFC
public class UserService : IUserService, IService
{
UserRepository userRep = new UserRepository();
public void AddUser(User user)
{
userRep.Add(user);
userRep.Save();
}
public void DeleteUser(User user)
{
userRep.Delete(user);
userRep.Save();
}
public User GetUser(Guid id)
{
return userRep.GetSingle(id);
}
public List<User> GetUsers()
{
return userRep.GetAll().ToList();
}
public void UpdateUser(User user)
{
userRep.Edit(user);
userRep.Save();
}
}
In the userRepository there is this method
public IQueryable<T> GetAll()
{
IQueryable<T> query = entities.Set<T>();
return query;
}
GetAll()
doesn't access the database. Query materialized only afterToList()
call – astef