Hi, all. I am using Entity Framework and decided to do some dependency injection in order to make my functions more testable. This seemed to bring up a few questions that I found difficult to solve. I guess the difficult part is figuring out the best practice of doing this, rather. So, to cut it short, I'm using Moq for mocking up the context class and the datasets. The class looks something like this: public class Auth { private dbcontext _ctx; public Auth(dbcontext ctx) { _ctx = ctx; } public bool Authenticate(string usr, string psw) { var a = _ctx.accounts.Where( …

Member Avatar
+0 forum 0

As I am new to Linq and Entity Framework, I don't know how I add comma sepearted and left join in linq/Entity code. My Sql query is rather big and I want it to be convert in Linq/entity: Select DISTINCT SR.StudentRequestId,SR.RegistrationId,SR.Location,SR.PaymentMethod,SR.CreatedOn,C.ClassName,CC.CampusName, CASE WHEN ISNULL(TSR.StatusId,0)=0 THEN 1 ELSE TSR.StatusId END AS StatusId, substring( ( Select ', '+REPLACE(REPLACE(ST1.FromTime,'AM',''),'PM','')+'-'+ST1.ToTime AS [text()] From dbo.StudentRequestTimings ST1 Where ST1.StudentRequestId = SRT.StudentRequestId ORDER BY ST1.CreatedOn For XML PATH ('') ), 2, 1000) [Time] FROM StudentRequest SR Inner JOIN Registration R ON R.RegistrationId=SR.RegistrationId INNER JOIN Campus CC ON CC.CampusId=R.CampusId INNER JOIN Class C ON C.ClassId=SR.ClassId LEFT JOIN TutorClasses …

Member Avatar
Member Avatar
+0 forum 1

Hi, I've recently "inherited" a part built project from a developer who as left our company. He had decided to use Entity Framework but I am finding it to be unstable and slow. I periodically have to reimport objects and stored procedures from the database as the model gets corrupted. I also find database processes to be slower than if I was just running stored procedures and ADO.net The latest fresh hell it has started to pull is an error *New transaction is not allowed because there are other threads running in the session.* I've looked on line and the …

Member Avatar
Member Avatar
+0 forum 5

I wrote a web page with one Russian word in it, using the Cyrillic alphabet character entity names (found in a list of all Unicode characters that I have). The page works fine in every browser I tried. But the W3C validator won't validate the page because the Cyrillic character entity names were used. It validates if I use the Unicode numbers instead, but that is such clanky programming. It reminds me of having to type in the ASCII code for every character the program displays in assembly language programming. Why can't we have the better programming practices? W3C seems …

Member Avatar
Member Avatar
+0 forum 14

Hi, I have been getting this error when doing savechanges(). System.Data.SqlClient.SqlException: New transaction is not allowed because there are other threads running in the session. I read this issue in many places and most are fixed with a .ToList() .First() or similar methods (basically not changing the object while the reading happens. I have made sure that this is taken care in the code. i get this error when i access the site and run from 2 different machines, and the i get this error from various places (sometimes when i save task A , some times B and so …

Member Avatar
+0 forum 0

# Performing Selective Includes in Entity Framework with the Fluent API # When we are using Entity Framework as our data access choice to work with SQL Server then there are some potential pitfalls. One of these pitfalls is doing selective includes. What do I mean by selective includes? To answer that let's first look at our class and database model. Lets suppose we have some customers and some invoices in our application. Our database schema and model classes could look like this: ![schema.png](/attachments/large/2/3ddde68520a7f7732b4b56cb8ef47c59.png "align-center") And we may have data like this: ![data.png](/attachments/large/2/1112ce0ee2ae9e0e575964c99e8e3e41.png "align-center") Now suppose we wanted to select …

Member Avatar
+1 forum 0

I have gone through "How Do I?" Videos for Visual C# but it is all about wpf , and the link is already expired Hoping for some help on this topic where user can choice columns to search in the lookup and when user pick one it search according to a pick of the column name please refer the images too . Hope someone will give me a article or video to refer ![Untitled1.png](/attachments/large/3/7fcde75a9ce41ccaa0d13b4fe3199bfd.png "align-center") ![Untitled.png](/attachments/large/3/6cd16dbf0b27832cb60b1438224985b6.png "align-center")

Member Avatar
Member Avatar
+0 forum 2

Below Code is not working. it is not displaying any thing on web browser can any one help me out? css file code: car_catlog { background-color:#FF0000; width:100%; background-image:url(car1.jpg); } car { display:block; border:solid; color:#FFF; margin-left: 10pt; } make,model,year,color,engine{ display:block; margin-left: 10pt; } number_of_doors,transmission_type,accessories { display:block; margin-left: 30pt; } XML FILE CODE: <?xml version="1.0" encoding ="utf-8"?> <?xml-stylesheet type= "text/css" href= "cars_catalog.css" ?> <!DOCTYPE car [ <!ELEMENT car_catalog (car)> <!ELEMENT car (make, model, year, color, engine,number_of_doors, transmission_type, accessories)> <!ELEMENT make (#PCDATA)> <!ELEMENT model (#PCDATA)> <!ELEMENT year (#PCDATA)> <!ELEMENT color (#PCDATA)> <!ELEMENT engine (number_of_cylinders, fuel_system)> <!ELEMENT number_of_doors (#PCDATA)> <!ELEMENT transmission_type (#PCDATA)> <!ELEMENT accessories …

Member Avatar
+0 forum 0

I'm using Entity Framework. Here is my code to update data : public bool UpdateProblem(Problem problem) { if (problem == null) { throw new ArgumentException("Cannot add a null entity"); } MathHubModelContainer ctx = new MathHubModelContainer(); ctx.Configuration.LazyLoadingEnabled = false; ctx.Configuration.ProxyCreationEnabled = false; DbEntityEntry attachtedEntrys = ctx.Entry(problem); // Find Currently Entity Entry in Context DbEntityEntry entry = ctx.Entry<Post>(problem); // if does not attatch yet. if (entry.State == EntityState.Detached) { // new entity here is wrapped by proxy Problem attachedProblem = ctx.Set<Problem>().Find(problem.Id); if (attachedProblem != null) { // get curently DBEntityEntry with AttachedProblem DbEntityEntry attachtedEntry = ctx.Entry(attachedProblem); attachtedEntry.CurrentValues.SetValues(problem); attachtedEntry.State = EntityState.Modified; } else …

Member Avatar
Member Avatar
+0 forum 1

Hi I am currently searching for entities in this case study and I am hoping to create an entity relationship diagram after I have found all the entities. So far I have managed to come up with the following entities Members Group members Organised club racing Training sessions Boat Design class ManageRace Ms Access system However I am not 100% sure wether this is enough, can you spot any more entities? Here is the case study ____________________________________________________________________________ Peak Park Sailing Club PPSC is a small sailing club located in the Pennines near Sheffield. They want to organise their event programme, …

Member Avatar
Member Avatar
+0 forum 1

Hello, I am a student and I was assigned to create my first entity relationship diagram and I'm kind of lost. The professor hints the paintings should be broken into a generalization hierarchy since they have so many attributes but I can only break them into two sub(entities) based on my understanding of G.H.(using the "is a" rule) Anyway I'm struggling with that and finding the weak entity(professor also hinted that there is a week entity) I attached what I have so far as ERD1.pdf (didn't establish relationship type/participation constraints yet) Am I even on the right track/have the right …

Member Avatar
Member Avatar
+0 forum 6

Hello, I have recently started to develop my own game in Java and am just starting to get the hang of it. I've watched various tutorials on making an engine etc and have picked up quite a lot. I am struggling with one problem though, I have a world and two entities (The player and a Rat). The player is controlled using the keyboard which was easy to setup. But, how can I randomly get the Rat to move in a random direction with random intervals all by itself? I've tried a few different ways but I'm getting quite a …

Member Avatar
Member Avatar
+0 forum 4

Hi everyone, I have created a twitter app to auto post to a number of twitter accounts. The auto tweet works great - but for one thing I am stuck on... I am trying to add a hashtag # (&#35;) to the tweet but for some reason I'ts not working. Do I need to use urlencode? im not how that would work. Here is the working auto tweet - What I am trying to do is add the hashtag before $wastteam So the tweet would look like this #Everton <?php twitter_post($wastuname . ' ' . has . ' ' . …

Member Avatar
Member Avatar
+0 forum 4

Hi I am the new in C# and I do some semestral project, I have done generating the entity data model, and I want to connect to the database from class by dbcontext using the ConnectionString. I have problem to bind a connection to these database. Can someone help me? There are my classes: 1.) this classes throw me warning that is obsolete public static class ConnectionSettings { public static String ConnectionString = ConfigurationSettings.AppSettings[@"data source=(localdb)\v11.0;initial catalog=SusibarDatabase;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;"]; } 2.)this is the the second: EntityContainer is the name in configuration of xml ublic class ItemDbContext : DbContext { public ItemDbContext() : …

Member Avatar
Member Avatar
+0 forum 2

I am having trouble to find the entities for this condition. Can anyone please help me here. A university has different types of staffs, e.g., lecturer, receptionist, cleaner etc. Should be recorded is class of jobs - Academic, Technical and General. An Academic can teach many subjects in a session (summer, winter) ............. University offers many degrees (post graduate and under graduate), and the degrees may be by coursework or by research. Each degree has many programs and each program has many courses.Need to clarify What type of course is that (core or elective). Any student can enroll many programs, …

Member Avatar
Member Avatar
+0 forum 2

What is meaning of "nature of entity"? e.g. kind of function, global variable? Is there any code to check it? Also, how to detect the memory section in memory map? e.g. environment, command line arguments, code/, global initialized data, global uninitialized data, stack, heap etc. Is there any code to check which kind of memory section? For example, I got a variable named "x1", what kind of code to check the "nature of the entity" + the "memory section"? Thanks.

Member Avatar
Member Avatar
+0 forum 3

I am using Entity Framework in Visual Studio linked to a back end database and would like to change the column name of the tables. Currently they have underscores which I want to remove, although there are many tables and columns. Is there an easy way to do this? I tried to edit properties on the DBML file but this did not work. Thanks in advance.

Member Avatar
+0 forum 0

Hi guys I need to find next highest no in a field that is a stick ref it has chars at front and 0 padded How so I strip off front chars and 0's to get actual highest no number in the table field? Am using LINQ against entity framework cheers George

Member Avatar
Member Avatar
+0 forum 4

I want to create a Entity class with database in Netbeans. When i select a Data source jdbc/Ionbank (custom Jdbc connection Using JDBC-ODBC bridge with Ms SQL 2005 as database). I see all the table from that database. All tables show no primary key, but they have primary keys in them. I am trying to find out what is problem. Thing i tried :- 1. Created new 4-5 data source. 2. Created tables using query, and not the New table option. 3. Tried changing Odbc connection. 4. Tried using different drivers for the Jdbc-Odbc bridge like Sql4jdbc.jar, Jdts.jar. Still No …

Member Avatar
Member Avatar
+0 forum 1

I Build an ASP.NET project with PL,BL,DAl, BE of Entity Data Model(=.edmx) which I generated from a service Based DB (= .mdf) which is located in my DAL project. I did copied the connectionString from the BE app.config to the PL web.config what's wrong? why I get this error: System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file C:\Documents and Settings\user\שולחן העבודה\למידה אישית\Lev\Lev\App_Data\Midrasha.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. my code logic is PL->BL->DAL- > try to save the new object to the DB. …

Member Avatar
+0 forum 0

we have done a video as part of the course work which explains about conceptual design for a small problem. I hope it might be helpful... here is the link.. [url]http://www.youtube.com/watch?v=k8JzkCq-5yA[/url] Thank you.

Member Avatar
+0 forum 0

Hi, I'm having trouble finding out whether I am doing my diagram the correct way or not. These are some of the properties of the diagram. Make an ER diagram and tables of the diagram: -Classroom contains the name of the building, the building number, and the space. -Reservation contains the day, hours and the expected amount of space. -Only the professor can reserve a room -Each course contains name / id And professor. -Each course must have a classroom -Only one professor per course I believe the Classroom and Course are the two entities and Reservation is the relation, …

Member Avatar
+0 forum 0

The End.