How to develop a Non generic repository design pattern
please redirect me to few relevant article which discuss about repository design pattern with EF implementation in c# project may be windows or web example but code will be non generic repository...
View ArticleEF cannot make up it mind on string formatting
"Charge" is type money"creditcared" is also the same typetxn.Transaction.creditcard.ToString() compiler is happytxn.Transaction.Charge.ToString() compliler complains about "no overload for method...
View ArticleHow to write the below code efficiently?
HiI want to use the LINQ to fetch only the records that falls between startValue and endValue. I don't want to loop all the records. How can i do that?var citedWorks = All().Where(c => c.CreatedDate...
View ArticleEF based Repository pattern and store procedure calling
i was searching google for this subject and found one link http://stackoverflow.com/a/27975496/728750the person sayingThe purpose of the Repository Pattern is to abstract away the storage &...
View ArticleAdding a new entity created an error
I created a new entity and then clicked build to save it. in the context I am shown the following error Inconsistent accessibility: property type 'DbSet<AssessmentReport>' is less accessible...
View ArticleHow to translate this SQL statement in to LINQ?
How to translate this SQL statement in to LINQ?SELECT G.GroupId, G.GroupName, G.GroupDescription FROM [dbo].[PartyGroup] AS G WHERE G.GroupId NOT IN (SELECT GroupId FROM [dbo].[UserGroup]...
View ArticleCircular Reference json serialize object in c# mvc
Hi,i want to get data in json format. but i'm getting response in string format so how can i resolve this issue, [HttpGet] public JsonResult DriverLogin(string username, string password, string...
View ArticleC# LINQ: How to select multiple field and return list
I have to select multiple fields and need to return a list.So I try to do it this way but I am getting an error. The error message is:Cannot implicitly convert type 'System.Linq.IQueryable' to...
View ArticleFluent API and keys from additional property class does not work
Hello,can someone please help me with the following problem:I would like to store the class "MyPerson" in a single table with the rows "Name, IdPart1, IdPart2" and use IdPart1 and IdPart2 as the key...
View Articleseeding an existing database
Ive created a database using the database first method and generated the poco's from the ado.net entity data model and put them into a separate domain model project in my solution. I wanted to seed...
View ArticleHow to use sql transaction and commit code in ASP.Net C#
Hii have a query in which i used SQL Begin transaction and commit transaction.and i need to use this code in my asp.net web page.here i am trying to delete record so i need to paas textbox value in...
View ArticleHow to get the range of strings between two given string values (A to M) in...
HiI want to return all the strings from startValue (e.g. A) to endValue (e.g. M). By using LIKE we can do it like this - LIKE '[A-M]%' How can we write the same LIKE query in LINQ.Thanksreturn Find(m...
View ArticleThe entity type 'UserRole' was not found. Ensure that the entity type has...
I have the following code to seed my UserRoles table:if (context.UserRoles.Any()) { return; } else //add user roles { var adminPersonID = context.Users.Where(u =>...
View Articlehow to choose between schema first, model first and code first?
i have some experience on web form and ado.net and complete few projects now i want to switch on asp.net mvc and for that i have to learn entity framework first. is it possible to make database module...
View ArticleCode First EF : executing stored procedure
I am getting this error message: The data reader has more than one field. Multiple fields are not valid for EDM primitive or enumeration typesThe stored procedure takes three parameters, two of them...
View ArticleDropdownlist Boolean Yes No Text
Hi ,I have a sql table graduated data type bit. Also dropdownlist data source linq to sql. I want to be if dropdownlist text true text=Yes else text false text=No . DataClasses1DataContext test = new...
View ArticleLinq to Sql dynamic
I have dropdown that will have a text and a value which will be used as the tablename.How would I do a linq to Sqlstring TName = ViewBag.Name;var get = (from p in db.[TName] .Where etc
View Articleorder by
hi, i would like to ask you how can i used GetAmountAff orderby descending. My code: var showbind = (from t1 in db.tbl_RegistrationPartners join t2 in db.aspnet_Memberships on t1.UserId equals...
View ArticleNested Entities Reference - Confused
I have been working my way through my first stand alone application. It is broadly based on the Contosso University tutorial and I am working in Asp.Net Core.So far, I have been having pretty good...
View ArticleIs EF Necessary?
Hi!I'm (finally) moving from WebForms to .Core.I'm using a current project from work as a test. This project is using a 3rd party SQL Server database. It's rather large and complicated, and when one...
View Article