Posts

Showing posts from June, 2018

Catch Database Exceptions - DbEntityValidationException - Entity Framework

Catch Database Exceptions - DbEntityValidationException - Entity Framework  (C#,.NET) When you developing .net application with C#, EntityFramework you may get " Validation failed for one or more entities " error sometimes. With this error you can't find exact error or entity field directly. you may have to do some extra work for that. I am using following simple code for simply find error field. This is straightforward and very very small code. We can catch our database exseptions Using  DbEntityValidationException (Under namespace System.Data.Entity.Validation)   in EntityFramework. Im using EntityFramework.6.x. It is also available in EntityFramework 5.x. In here i am writing my exceptions in to text file in my C: drive ( C:\Shared\Error.txt ) Remember you have to give proper permissions for C: drive if you want to write data into text file. I am here i am using this for simplicity and tutorial purpose. try { //Your database operations. } c

ASP.NET Identity With Oracle Database

Image
In this topic i will try to give you some idea about using ASP.NET identity with Oracle Database for our MVC applications. At the beginning, I have done some research about suing identity with Oracle DB. There few useful articles i found, but not with complete details. Today i will try to cover most of the steps in this article. Below script include identity tables for Oracle DB. You can find some scripts on the internet, but here my good friend (DB guy) at one of my work place, taught me to recreate those scripts in a better way for Oracle DB. You can run those scripts in your DB. (If you have any problems running this scripts, let me know in the comment section). CREATE TABLE incapp.AspNetRoles ( Id VARCHAR2(128) NOT NULL, Name VARCHAR2(256) NOT NULL ) pctfree 20 pctused 70 tablespace INCTBL; create unique index incapp.pk_aspnetroles on incapp.AspNetRoles ( id ) pctfree 10 tablespace incidx; alter table incapp.AspNetRoles add ( constraint pk_asp