I already posted another post today about solving Visual Studio 2018 Stuck at 'preparing solution'
If you follow the same solution you will be able to build your solution.
Showing posts with label Entity Framework. Show all posts
Showing posts with label Entity Framework. Show all posts
Entityframework Oracle.ManagedDataAccess.Client.OracleException: 'ORA-01950: no privileges on tablespace 'USERS''
EntityFramework Oracle.ManagedDataAccess.Client.OracleException: 'ORA-01918: user 'dbo' does not exist'
While trying to use code first approach to connect to Oracle database using ASP NET C#.
I received the following exception
The Reason for the error is that Oracle tried to create my tables which are in my first migration into dbo schema as SQL Server do, but in Oracle it is a User.
So you need to till Entity Framework where is my Table Should be
You have two solutions
First is to use DbModelBuilder.HasDefaultSchema
This will make all of your tables in this schema.
Second is to use System.ComponentModel.DataAnnotations.Schema.Table
This will give you the ability to change the schema when ever you want
I received the following exception
Oracle.ManagedDataAccess.Client.OracleException: 'ORA-01918: user 'dbo' does not exist'
My current User Is IT_USERThe Reason for the error is that Oracle tried to create my tables which are in my first migration into dbo schema as SQL Server do, but in Oracle it is a User.
So you need to till Entity Framework where is my Table Should be
You have two solutions
First is to use DbModelBuilder.HasDefaultSchema
This will make all of your tables in this schema.
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.HasDefaultSchema("IT_USER");
base.OnModelCreating(modelBuilder);
}
{
modelBuilder.HasDefaultSchema("IT_USER");
base.OnModelCreating(modelBuilder);
}
Second is to use System.ComponentModel.DataAnnotations.Schema.Table
This will give you the ability to change the schema when ever you want
[Table("STD_FA_VALIDATION", Schema ="IT_USER")]
public class STD_FA_VALIDATION
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int SGBSTDN_PIDM { get; set; }
public string NAT_CHANGE_IND { get; set; }
public string WORK_IND { get; set; }
public DateTime NAT_PROC_DATE { get; set; }
public DateTime WORK_PROC_DATE { get; set; }
}
public class STD_FA_VALIDATION
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int SGBSTDN_PIDM { get; set; }
public string NAT_CHANGE_IND { get; set; }
public string WORK_IND { get; set; }
public DateTime NAT_PROC_DATE { get; set; }
public DateTime WORK_PROC_DATE { get; set; }
}
Unable to create a constant value of type ‘’. Only primitive types or enumeration types are supported in this context.
the problem appears because you are using contains method in non primitive type
here is an example
note ints object, this will solve the problem.
because ints collection is list of int it can use contains method inside entity framework
here is an example
Audit audit = new Audit();
List<int> ints = userReports.Select(y => y.ReportId).ToList();
List<int> ints = userReports.Select(y => y.ReportId).ToList();
List<ReportUserVisit> userReportLastMonthVisit = audit.GetAudit(userId, AuditType.Report)
.Where(x => ints.Contains((int)x.ObjectId))
.Select(x=> x.ObjectId)
.GroupBy(x=>x.Value)
.Select(x=>new ReportUserVisit { ReportId = x.Key, LastMonthVisitCount= x.Count() })
.ToList();
.Where(x => ints.Contains((int)x.ObjectId))
.Select(x=> x.ObjectId)
.GroupBy(x=>x.Value)
.Select(x=>new ReportUserVisit { ReportId = x.Key, LastMonthVisitCount= x.Count() })
.ToList();
because ints collection is list of int it can use contains method inside entity framework
Subscribe to:
Posts (Atom)
filter attribute that checks whether current connection is secured
using APS.net Core to mark all website pages working with https protocol we will do this using IAuthorizationFilter. and here is an exampl...
-
To remove duplicates from JavaScript array. you can use the following javaScript function, you need JQuery to be able to run this functio...
-
To get the month names using a given Culture Info in a simple select list var monthOfBirthValues = new List (); monthOfBirthValues.Add(...
-
problem: I have a simple project hosted on our company TFS. our security policy required the development team change there passwords every 1...