FAQ Database Discussion Community


Serialize poco containing object property into Json

c#,xml,serialization,json.net,poco
I have a class that I need to serialize to pass to another system. The class contains a property that is defined as an object, because the type of class the object will contain can vary at runtime. My classes looks something like this simplified mock up; public class MyTestXML...

Queries on Repository Layer in MVC application

asp.net-mvc,repository-pattern,poco
I am building MVC 5 application using Razor. My application is layered as below: UI Layer: Comprising of Model, View and Controller. Data Access Layer: Connection and Stored Procedure classes Business Layer (Service Layer) Repository I referred to Contosso Sample Application. There it is using DAL to store Repository. But...

What is the cause of this EF6 behaviour Find() does not return a proxy but Single() does return a proxy

c#,entity-framework,entity,poco,proxy-classes
I have a POCO class BankAccount which is public and all of the members are public properties and navigation properties are set to virtual. Entity Framework 6.1.2 correctly loads it from the database as a POCO using the Find() method. However, as far as I am aware it should be...

Multiple Http Servers with Poco and Boost C++

c++,boost-asio,poco,poco-libraries
I'm trying to create multiple Http servers with Poco::Net and Boost libraries, but is occurring the following error internally in Poco file Application.cpp: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Assertion violation: _pInstance == 0 [in file "src/Application.cpp", line 115] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I'm using the code below: #include <Poco/Net/HTMLForm.h> #include <Poco/Net/HTTPServerRequest.h> #include <Poco/Net/HTTPServerResponse.h> #include <boost/asio/io_service.hpp> boost::asio::io_service...

EF 5 Code First Mapping Issue

c#,entity-framework,poco
Does anyone know if there's a trick to getting EF, code first, to map two tables with the same name, but different schemas? This is the error I'm getting: The type 'DAL.dbo.Employer' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or...

Entity Framework Error Deleting Entity with Foreign Key Relationship

entity-framework,entity-framework-6,poco
I am having a problem deleting some entities due to a foreign key relationship. I understand the following error message and have been doing everything I can think of to delete the entities without incurring this error: The DELETE statement conflicted with the REFERENCE constraint "FK_QuizUserAnswer_QuizWithQuestion". The conflict occurred in...

Performance Issues with Include in Entity Framework

json,entity-framework,repository-pattern,asp.net-web-api2,poco
I am working on a large application being developed using Repository Pattern, Web APIs, AngularJS. In one of the scenario, I am trying to retrieve data from a single lead which has relations with approx. 20 tables. Lazy loading is disable, so I am using Include to get the data...

Custom changes to entity generated classes

c#,vb.net,entity-framework-6,poco,t4
I am using VS 2013, EF 6, and database first. I have generated entity from database and would like to shut off auto generation as I would like to add custom attributes to the generated classes. My classes were generated using T4, how do I make custom changes / disable...

Entity Framework code first: How to ignore classes

c#,entity-framework,poco,dbcontext
This is similar to questions here and here, but those are old and have no good answers. Let's say I have the following classes: class HairCutStyle { public int ID { get; set; } public string Name { get; set; } } class CustomerHairCutPreference { public int ID { get;...

Meaning of POCO classes in MVVM and Entity Framework

wpf,entity-framework,mvvm,data-binding,poco
Please bare with me as I am in process of learning. I am trying to understand how WPF binding works in junction with MVVM and Entity Framework. So far I understand databinding as a concept related to properties. However, when it gets to EF I lose understanding of which objects...

EF 6.x Code First: Different SQL Generated for Navigation Property - What am I doing wrong?

entity-framework,ef-code-first,linq-to-entities,poco
I'm a veteran web developer with plenty of T-SQL and schema designing experience, but, fairly new to EF (skipping right to EF 6!). I'm wondering what's wrong with my POCOs that I'm getting different SQL generated for the following two queries. Basically, I have two objects, "Parent" and "ChildThing" with...

MVC5 Scaffolding Dropdowns Out the Box

asp.net-mvc,asp.net-mvc-5,poco,html.dropdownlistfor,asp.net-mvc-scaffolding
I want to view, edit and create with drop-down list of my lookup relationships. Sometimes this works, sometimes it doesn't. It's a mystery that I'm hoping can be definitely solved here. Here's my POCO's for the lookup public class Color { public int Id { get; set; } public string...

Encrypt in C# using OpenSSL compatible format, decrypt in Poco

c#,c++,cryptography,openssl,poco
I'm trying to encrypt (aes-128-cbc) in Win OS using a OpenSSL compatible format and decrypt on Linux OS using Poco::Crypto that is a wrapper of OpenSSL. I'm using a pwd and salt. Digging in the Stack Overflow, OpenSSL and Poco I found that: 1) from the Win end (I used...

Extension Methods vs Instance Methods vs Static Class [closed]

c#,extension-methods,poco,static-classes,instance-methods
I'm a little bit confused about the different ways to use methods to interact with objects in C#, particularly the major design differences and consequences between the following: Invoking an instance method Using a static class on a POCO Creating an extension method Example: public class MyPoint { public double...