E-F code first database design: Choosing which model classes are part of the...
When creating model classes in a project that is using code-first with E-F, does E-F only create database entities for classes that you have defined a DbSet for? For example, if I had the following...
View Articleinsert existing json in db
Hi,My code:var obj = new { data = new { post_info = new { ID = "1", UserId = HttpContext.Current.Request.Cookies["UserId"], date = DateTime.Now, imgpath = "none", videopath = "none", likecount = "1",...
View ArticleAdditional information: User without permissions.
private StockTicker(IHubConnectionContext<dynamic> clients) { Clients = clients; //Posts var mapper = new ModelToTableMapper<Posts>(); mapper.AddMapping(s => s.ID, "ID");...
View ArticleContext.SaveChanges() in foreach throwing "already an open data reader..." error
I have some c# code that looks something like this: using (var objContext = Entities.EntityUtils.GetSiteEntity(true)) { var Articles = from art in objContext.v2_article where ...SOME CONDITION IS...
View ArticleSqlTableDependency_Changed what permission
Hi, I have 2 database. One is from test with the same database: https://www.codeproject.com/Articles/1029976/SQL-Server-Notifications-on-Record-Change-with-Sigvoid SqlTableDependency_Changed(object...
View Articletwo datareader relation between two tables
Hi, I want to retrieve from second table commend under PostId.var connectionString = ConfigurationManager.ConnectionStrings ["ConnectionString"].ConnectionString; using (var sqlConnection = new...
View ArticleDoes loading SqlDataReader data into object is possible in c#
Hi All,I want to know does loading SqlDataReader data into "default" object is possible? If yes, then how to make the code below to work.The code doesn't give any error but showing no data. private...
View Articlenvalid column name 'Home_Id'. - CODE FIRST MANY TO MANY RELATIONSHIP in...
This is the code im working with , and im trying to build many to many relationship between Home and Event tables , but im getting this result :http://localhost:49477/Homes/IndexCREATE TABLE...
View ArticleHow to convert a query to lambda based
var usersWithRoles = (from user in context.Users select new { UserId = user.Id, Username = user.UserName, Email = user.Email, RoleNames = (from userRole in user.Roles join role in context.Roles on...
View ArticleHow to fetch master detail data using EF and LINQ
suppose i have a order and order detail entity. i want to fetch specific order data and its related order detail by EF.can i use this LINQ queryIEnumerable<Order> order= _ctx.order .Include(x...
View ArticleEF left or right join
see the queryvar answer = (from c in db.customers join p in db.purchases on c.ID = p.CustomerID into subs from sub in subs.DefaultIfEmpty() group sub by new { c.ID, c.Name } into gr select new {...
View ArticleHow to show customer data and order count using LINQ
my table structures areCustomer ---------- CustomerID FirstName LastName PhoneNo Email Order -------- CustomerID OrderID OrderStatus OrderDate TotalPrice OrderDetails ------------ ID OrderID ProductID...
View ArticleHow to save single entity/class data to multiple table
so tell me how could i design whole things. suppose i have a registration class what has so many properties likeAccount information ---------------------- First Name Surname Company Name Contact Number...
View ArticleError, " Cannot open database "BrentPractice" requested by the login. The...
How do I fix my code where I can open the database? Here is my code:public int InsertCommand(int logId, string edi, string personFormalName, DateTime activityDateTime, string activityTypeDescriptor,...
View ArticleLinq Update List marking duplicates based of a columns in the list .
Goal: I am sure there is a better way of doing this and would appreciate this learning opportunity.I have a list of products and want to find all duplicate products in the list, then mark the...
View ArticleError openning a connection
Here is the error: A connection was successfully established with the server, but then an error occurred during the login process, error 0, No process is on the other end of the pipe. What cause this...
View ArticleStore the Controllers name and Actions Name into my Custom Tables that I Add...
Seniors, <br/> I'm using ASP.NET Identity on my ASP.Net web application and I Add my custom Tables(with their relations) to Identity on myCodeFirst ASP.Net MVC Project.when I Run Project for the...
View ArticleEntity framework acces by reference
how to reference to properties of entitiy framework models?ReferenceTest(EntityModel.Adress)sub ReferenceTest(t as property)msgbox(t)end sub
View Articleentity framework acces by string name
hi.how do i acces an model's column name by string?such asmyrowmodel.column("id)) = "465746"myrowmodel.column("food)) = "fish"and how do i convert it back to string?dim str as string =...
View ArticleCan not migrate Database
Hello. I don't know how to just ask the question.When I run update-database, a database is created. However, without the table __Migrations (or whatever its name was). The database is up-to-date. When...
View Article