poco

DataSets to POCOs - an inquiry regarding DAL architecture

走远了吗. 提交于 2019-12-14 03:46:27
问题 I have to develop a fairly large ASP.NET MVC project very quickly and I would like to get some opinions on my DAL design to make sure nothing will come back to bite me since the BL is likely to get pretty complex. A bit of background: I am working with an Oracle backend so the built-in LINQ to SQL is out; I also need to use production-level libraries so the Oracle EF provider project is out; finally, I am unable to use any GPL or LGPL code (Apache, MS-PL, BSD are okay) so NHibernate/Castle

How can we get DynamicData working with EFPocoAdapter?

微笑、不失礼 提交于 2019-12-14 02:03:46
问题 My team is hoping to use the EFPocoAdapter, but are also hoping to use the DynamicData tools with it but are having some issues. We basically added a "Dynamic Data Entities Web Application" project to the EFPocoAdapter Northwind sample solution (I am using the latest version, 1.03), referenced the needed assemblies and then uncommented and edited the line in the Global.asax.cs file that registers a context with the MetaModel to look like this: model.RegisterContext(typeof(NorthwindEF

Entity Framework Error Deleting Entity with Foreign Key Relationship

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-14 01:47:21
问题 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 database "SomeDatabase", table "dbo.QuizUserAnswer", column 'idQuizQuestion'. The statement has been terminated. Here is an image of the two tables in

Programmatically Enabling/Disabling Entity Proxies

白昼怎懂夜的黑 提交于 2019-12-14 00:54:47
问题 I am using the Entity Framework 4.1 with POCO entities in a new project. Everything was working fine until I began caching the entities using AppFabric Caching. I started getting erros retrieving the entitis from the cache related to deserializing the proxy objects. I fixed this problem by setting ContextOptions.ProxyCreationEnabled = false. The issue now is when I get entities back from the cache, I have to attach the entity to the current context using ObjectSet.Attach(entity) and add them

Entity Framework 4.2: Multiple entities using the same many-to-many relationships

末鹿安然 提交于 2019-12-13 18:04:48
问题 I have a table Travelers : CREATE TABLE [dbo].[Travelers]( [TravelerId] [int] IDENTITY(1,1) NOT NULL, [FirstName] [nvarchar](25) NULL, [LastName] [nvarchar](50) NULL a table Transporters and a join table TransporterTravelers CREATE TABLE [dbo].[TransporterTravelers]( [Transporter_TransporterId] [int] NOT NULL, [Traveler_TravelerId] [int] NOT NULL, to create a many-to-many relationship between travelers and transporters. I used POCO classes to create the entities Traveler and Transporter, and

Entity Framework projection into class is faster than selecting EF POCO objects, WHY?

半城伤御伤魂 提交于 2019-12-13 16:54:14
问题 This one confounds me. I am using EF 4.1 and have applied a T4 template to the model to use POCO's and POCO proxies (public paramaterless ctor, all properties are virtual, all navigation properties are ICollection). I have a table with around 1.1M records in it. I was doing some timing tests to see how long it takes to retrieve this data and got some unexpected results. This call returns in about 21 seconds: ctx.Valuations.MergeOption = MergeOption.NoTracking var entityValuations = ctx

Entity framework IQueryable with poco generation

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 13:03:52
问题 I've created a T4 template which generates standard Entities classes along with Interfaces for each of their properties so that I can make customized poco objects containing only the data that I want. I've also created a copy function which can convert between any of the objects which implement said entity's interface The generated code looks like this //------------------------------------------------------------------------------ // <auto-generated> // This code was generated from a

Trying to find the top 3 properties of a POCO instance

為{幸葍}努か 提交于 2019-12-13 09:48:18
问题 I have a simple POCO class that contains the student's scores. For example: Math - 83% Engrish - 82% Chemistry - 81% Drama - 100% etc.. Is there a way (using LINQ?) that I could figure out the top 3 properties ordered by score? I'm assuming the final object will be an IList<T> of an anonymous type, which will have two fields. Name (the name of the property) Score (the decimal value). The number of properties in the object ARE finite though :) Any suggestions? As an alternative answer, could

Adding POCO Entities

旧城冷巷雨未停 提交于 2019-12-13 03:56:52
问题 I have an EDMX file with context.tt and .tt file. I have POCO classes under .tt file. I have one more EDMX with POCO files. I want to copy some POCO classes from 2nd EDMX to 1st EDMX. Please keep in mind that the tables are different in both the EDMX. Just wanted to find out if its possible to copy one POCO class from EDMX and .tt file to another. Any help would be appreciated. 回答1: Solution was easy. Change the connectionstring of EDMX file. In my case I had to create a 2 Function imports

Poco::Logger print int8_t value

徘徊边缘 提交于 2019-12-13 03:55:09
问题 I am trying to print int8_t value with Poco::Logger in this way: using myint8_t = signed char; myint8_t var; var = 10; logger().information("%c", var); logger().information("%d", var); logger().information("%i", var); But as output have error which tells me that argument does not match the format specifier: 2018-10-02 00:12:40.627 [Information] [ERRFMT] 2018-10-02 00:12:40.627 [Information] [ERRFMT] 2018-10-02 00:12:40.627 [Information] [ERRFMT] Where is my mistake and how to print signed