poco

Entity Framework Skip method running very slow

与世无争的帅哥 提交于 2019-12-05 05:56:58
I'm using Entity Framework 5, ObjectContext and POCOs on my data access layer. I have a generic respository implementation and I have a method that queries the database with paging using Skip() and Take(). Everything works fine, except that the query performance is very slow when skipping a lot of rows (I'm talking about 170k rows) This is an excerpt of my query on Linq to Entities: C# Code: ObjectContext oc = TheOBJEntitiesFactory.CreateOBJEntitiesContext(connection); var idPred = oc.CreateObjectSet<view_Trans>("view_Trans").AsQueryable(); idPred = idPred.OrderBy(sortColumn, sortDirection

Multiple Http Servers with Poco and Boost C++

好久不见. 提交于 2019-12-05 05:40:55
问题 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>

What is the best way of using DTOs in a SOA application?

允我心安 提交于 2019-12-05 05:03:36
We are implementing a SOA web application using EF, WCF and jQuery. Here is our architecture in a brief view: ------------- --- | UI | | | ------------- | | | Services | | D | ------------- | T | | Businsess | | O | ------------- | | | Dal | | | ------------- --- We know that we should have DTO classes to pass data between the layers specially between the Services and the UI but We have some conceptual issues about the way of using DTOs (to send to the UI or receive from UI). For Data-Driven project we can use POCO to generate the DTO objects automaticly. But in big applications it's not that

POCO Vs Entity Framework Generated Classes? [closed]

蓝咒 提交于 2019-12-05 03:47:46
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . What are the advantages of using one over the other ? I know POCO classes are more optimal but are they worth the overkill ? And should we always be using POCO's or is there a time when you should prefer entity framework classes ? The EF

How do i populate a POCO (child) IList property from a Linq2Sql query?

陌路散爱 提交于 2019-12-05 01:02:10
问题 I have a two classes: public class Question { public IList<Answer> Answers { get; set; } } public class Answer { .. } In my Linq2Sql designer, there's two L2S objects on designer, with the correct 0<->many arrow between them. Kewl. I'm not sure how i can retrieve these questions/answers in a single call and populate my POCO objects .. this is what i've got ... can someone fill in the blanks? public IQueryable<Question> GetQuestions() { return from q in _db.Questions select new Question {

How to eager load child entities using repository pattern

谁说胖子不能爱 提交于 2019-12-05 00:00:54
问题 I have an entity named Tour which can have many Agents . I am able to add agents, but I cannot remove them. // _repo is injected.... var tour = _repo.GetById(tourId); tour.AddAgent(new Agent(tour.TourId)); When I attempt to call the Tour.RemoveAgent() method nothing is actually removed. I set a breakpoint inside the Tour.RemoveAgent() method I see that the _agents property has a count of 0 . tour.RemoveAgent(agentId); // This doesn't work because _agents is empty Do I have to do something

Custom setter for C# model

落爺英雄遲暮 提交于 2019-12-04 23:06:06
I don't know how to make custom setter for C# data model. The scenario is pretty simple, I want my password to be automatically encrypted with SHA256 function. SHA256 function works very well (I've used in in gazillion of projects before). I've tried couple of things but when I run update-database it seems it's doing something recursively and my Visual Studio hangs (don't send error). Please help me understand how to make passwords be encrypted by default in model. Code with what I've already tried public class Administrator { public int ID { get; set; } [Required] public string Username { get

Loading from database without proxy classes?

戏子无情 提交于 2019-12-04 21:06:21
问题 In Entity Framework 4 Is it possible to choose to load some queries into a POCO without it using proxy classes? (For the purpose of caching that object for future read only use). I am using the Repository - Service pattern. By this I mean: var order = _orderService.GetById(1); // after order is loaded then we can see in the debugger that: // order.Customer is of type System.Data.Entity.DynamicProxy.Customer_17631AJG_etc What I want is for the order.Customer to actually use the POCO type MyApp

Fetching Strategy example in repository pattern with pure POCO Entity framework

百般思念 提交于 2019-12-04 19:24:21
I'm trying to roll out a strategy pattern with entity framework and the repository pattern using a simple example such as User and Post in which a user has many posts. From this answer here , I have the following domain: public interface IUser { public Guid UserId { get; set; } public string UserName { get; set; } public IEnumerable<Post> Posts { get; set; } } Add interfaces to support the roles in which you will use the user. public interface IAddPostsToUser : IUser { public void AddPost(Post post); } Now my repository looks like this: public interface IUserRepository { User Get<TRole>(Guid

Can EF4 generate POCO for me, or do I have to write them myself?

女生的网名这么多〃 提交于 2019-12-04 16:56:55
I've been playing about with the Entity 4 framework lately and it's pretty nifty. I've setup a class called Customer.cs with some properties like Name, Address etc. I also have a class called StoreEntities.cs which binds these back to the database through DbSet. It works fine and I can pull all my customers from the database. The problem is every tutorial I come across on the internet generates their classes by hand. What I mean is, they all say something like "Now I'm going to make a new class called Orders with the following properties" and then proceed to write it out. That might be ok if I