Hi.
I can properly connect to SqlServer using EF6 with DbContext.
However, whenever i try to interact with any of DB items i get an exception for missing System.Data.OracleClient.
Adding it to resources just gives an error for “invalid connection string”, because as I suppose it mistakes it for OracleConnection?
To my knoweledge, it shouldn’t be happening because I don’t even use OracleClient as db provider?
DbContext code:
public static ApocalypseDbContext Instance = new ApocalypseDbContext();
public ApocalypseDbContext() : base("Data Source=DESKTOP-TRRN8HR;Initial Catalog=apocalypse-rp;Integrated Security=True")
{
}
public DbSet<CharacterModel> Characters { get; set; }
CharModel:
class CharacterModel
{
[Key]
public int ID { get; set; }
[Required]
public string SteamID { get; set; }
[Required]
public string FirstName { get; set; }
[Required]
public string LastName { get; set; }
[Required]
public string Faction { get; set; }
}
Running this code gives me the error:
try
{
ApocalypseDbContext.Instance.Characters.ToList(); // However, whenever i actually try to add to database , read from it or remove something, it gives me that strange error.
ApocalypseDbContext.Instance.SaveChanges(); // Can actually run it without any errors
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
Debug.WriteLine(e.InnerException.ToString());
}
Debug.WriteLine("Done saving changes.");
App.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Can I actually get it to work without using any unnecesary stuff?