poco

What causes POCO proxy entities to only sometimes be created in Entity Framework 4

不羁的心 提交于 2019-12-08 05:37:59
问题 I have set up my POCOs and I have marked their public properties as virtual and I am successfully getting Proxies most of the time (95%) but randomly I am getting EF return some proxies and some non-proxies. Recycling the app pool when this happens will then fix this instance of the error and it will go away for an amount of time. Then it will re-occur in some other random (it seems) place. What can cause this sort of behaviour? alt text http://www.freeimagehosting.net/uploads/36c95af3c7.jpg

POCOs and multiple ViewModels pointing to the same POCO?

蹲街弑〆低调 提交于 2019-12-08 04:16:33
问题 How would one go about handling a situation like this? Having more than one ViewModel having a reference to the same POCO object. ViewModel A updates the POCO... now ViewModel B needs to know about this somehow? 回答1: Assuming that your POCO can't implement INotifyPropertyChanged , you could use a mediator pattern to alert other view models when a POCO is changed: public interface ICareWhenAModelChanges<T> { void ModelUpdated(T updatedModel); } public class ModelChangeMediator<T> { private

How to extend C++ HTTP server with FastCGI applications?

ぐ巨炮叔叔 提交于 2019-12-08 03:09:30
问题 I am writing a C++ HTTP server. But because developing in C++ is slower as for example in PHP I want to also support FastCGI applications (PHP via FastCGI, Python via FastCGI, etc.). So I want to use something similar to mod_fcgi (for Apache). Does someone know a good C++ FastCGI library (not for applications but for the webserver) ? I use the Poco library to write the webserver. Another solution could be to use an PHP interpreter directly in my C++ server. Does anybody know some examples for

Using FluentValidation with Castle Windsor and Entity Framework 4.0 (POCO) in MVC2

 ̄綄美尐妖づ 提交于 2019-12-08 00:31:27
问题 This isn't a very simple question, but hopefully someone has run across it. I am trying to get the following things working together: MVC2 FluentValidation Entity Framework 4.0 (POCO) Castle Windsor I've pretty much gotten everything working. I have Castle Windsor implemented and working with the Controllers being served up by the WindsorControllerFactory that is part of MVCContrib. I also have Castle serving up the FluentValidation validators as is described by this article: http://www

Is my understanding of POCO's + Entity Framework v4, correct?

隐身守侯 提交于 2019-12-07 23:10:22
问题 can someone please confirm/correct me, with my understanding of using POCO's with the Entity Framework v4? If I'm going to want to use POCO's with my EF4 context, do I still need to place/create ENTITIES on the designer/.edmx ? Isn't the idea of using POCO's so I don't need to use those 'heavy' entities? or do i still need those entities, it's just that somewhere else I actually move the data out of the entities and into my POCO's .. which is what gets used by any consuming code? 回答1: If you

LINQ to XML to POCO object

自作多情 提交于 2019-12-07 13:46:50
问题 I've got an XML file that I want to turn in to a list of POCO objects. I have the following working code to read the XML and create objects from it. I just want to check this is a good way to do this and I'm not missing any tricks. In particular with regards to the nested Linq query. XDocument xmlDoc = XDocument.Load(path); var q = from file in xmlDoc.Descendants("File") select new ImportDefinition() { Name = file.Attribute("Name").Value, TypeName = file.Attribute("TypeName").Value,

C# Entity Framework should we set a relationship by using the POCO.Id or just the POCO?

不羁的心 提交于 2019-12-07 13:33:41
问题 I have a situation in a service method where assigning a POCO as a child object of another POCO does not work as expected. I am using Entity Framework 4. public void ChangeOrderCurrency(Currency currency) { order.CurrencyId = currency.Id; order.Currency = currency; // other stuff related to exchange rates etc } Which is more correct to use to set the relationship? order.CurrencyId = currency.Id or order.Currency = currency ? In this current code which passes all unit tests, occasionally the

POCO classes and ViewModels in MVC3

时光怂恿深爱的人放手 提交于 2019-12-07 13:01:10
问题 I am not an experienced MVC3 developer but I'm trying to be. I am familiar with POCO classes and also ViewModels, as the former describes each classes of the database and the latter is used for strong type views in mvc3. My question is not that complicated for the experienced developers but I am a little confused about that. The matter is that, I have a solution containing three projects; The Model class library in which I have wrote my POCO classes. Here is an example: . public class Service

Deserialize nested JSON Response with RestSharp Client

巧了我就是萌 提交于 2019-12-07 12:56:23
问题 I'd like to consume a REST Api and deserialize the nested JSON Response. For that purpose I tried to create some POCO classes which represent the JSON Response [1]. The response looks like this: { "success": true, "message": "OK", "types": [ { "name": "A5EF3-ASR", "title": "ITIL Foundation Plus Cloud Introduction", "classroomDeliveryMethod": "Self-paced Virtual Class", "descriptions": { "EN": { "description": "some Text null", "overview": null, "abstract": "Some other text", "prerequisits":

ASP.NET MVC 4 Multiple Foreign Keys Referencing Single Parent Entity

孤街浪徒 提交于 2019-12-07 11:58:44
问题 I am trying to develop an ASP.NET MVC 4 application where players can be rated according to their Offence, Defence and Assist skills. Offence, Defence and Assist are foreign keys on Player table referencing the same lookup table - Rating. I have the following parent entity: public class Rating { public int Id { get; set; } public string Name { get; set; } public virtual ICollection<Player> Players { get; set; } } And child entity: public class Player { public int Id { get; set; } public