Search Results

Search found 324 results on 13 pages for 'poco'.

Page 1/13 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Poco library for c++, declare namespace for custom element

    - by Mikhail
    I want to create an XML document by building a DOM document from scratch, with syntax like: AutoPtr<Document> doc = new Document; AutoPtr<Element> root = doc->createElement("root"); doc->appendChild(root); AutoPtr<Element> element1 = doc->createElementNS("http://ns1", "ns1:element1"); root->appendChild(element1); AutoPtr<Element> element2 = doc->createElementNS("http://ns1", "ns1:element2"); root->appendChild(element2); DOMWriter writer; writer.setNewLine("\n"); writer.setOptions(XMLWriter::PRETTY_PRINT); writer.writeNode(std::cout, doc); But, when I write it, I get next result: <root> <ns1:element1 xmlns:ns1="http://ns1"/> <ns1:element2 xmlns:ns1="http://ns1"/> </root> So namespace ns1 declared two times, and I want to declare it inside "root" element. Is there way to get next representation: <root xmlns:ns1="http://ns1"/> <ns1:element1/> <ns1:element2/> </root>

    Read the article

  • Learning resources for working with POCO entities in EF 4.0

    - by boghydan
    Here are some links that can help you start working with POCO entities in EF 4.0: ADO.NET Team blog: - Working with POCO objects: http://blogs.msdn.com/adonet/archive/2009/05/21/poco-in-the-entity-framework-part-1-the-experience.aspx - Proxy objects for POCO entities: http://blogs.msdn.com/adonet/archive/2009/12/22/poco-proxies-part-1.aspx MSDN Library: - Working with POCO  http://msdn.microsoft.com/en-us/library/dd456853.aspx - T4 editor for POCO generator can be downloaded from here: http://visualstudiogallery.msdn.microsoft.com/en-us/60297607-5fd4-4da4-97e1-3715e90c1a23

    Read the article

  • what is Entity Framework with POCO

    - by pdiddy
    What is the benefit of using POCO? I don't understand the meaning of Persistence Ignorance, what does this mean? That the poco object can't expose things like Save? I can't wrap my head around this POCO that there's alot of buzz around. What is the difference with the EF generated entities and POCO?

    Read the article

  • Entity Framework 4 + POCO with custom classes and WCF contracts (serialization problem)

    - by eman
    Yesterday I worked on a project where I upgraded to Entity Framework 4 with the Repository pattern. In one post, I have read that it is necessary to turn off the custom tool generator classes and then write classes (same like entites) by hand. That I can do it, I used the POCO Entity Generator and then deleted the new generated files .tt and all subordinate .cs classes. Then I wrote the "entity classes" by myself. I added the repository pattern and implemented it in the business layer and then implemented a WCF layer, which should call the methods from the business layer. By calling an Insert (Add) method from the presentation layer and everything is OK. But if I call any method that should return some class, then I get an error like (the connection was interrupted by the server). I suppose there is a problem with the serialization or am I wrong? How can by this problem solved? I'm using Visual Studio S2010, Entity Framework 4, C#. UPDATE: I have uploaded the project and hope somebody can help me! link text UPDATE 2: My questions: Why is POCO good (pros/cons)? When should POCO be used? Is POCO + the repository pattern a good choice? Should POCO classes by written by myself or could I use auto generated POCO classes?

    Read the article

  • Generate POCO classes in different project to the project with Entity Framework model

    - by Max
    I'm trying to use the Repository Pattern with EF4 using VS2010. To this end I am using POCO code generation by right clicking on the entity model designer and clicking Add code generation item. I then select the POCO template and get my classes. What I would like to be able to do is have my solution structured into separate projects for Entity (POCO) classes and another project for the entity model and repository code. This means that my MVC project could use the POCO classes for strongly typed views etc and not have to know about the repository or have to have a reference to it. To plug it all together I will have another separate project with interfaces and use IoC. Sounds good in my head I just don't know how to generate the classes into their own project! I can copy them and then change the namespaces on them but I wanted to avoid manual work whenever I change the schema in the db and want to update my model. Thanks

    Read the article

  • Poco SocketReactor Scalability

    - by Genesis
    I have written a proxy server for Linux using Poco but have since been reading up on the various approaches to achieving TCP/IP server scalability. I will need the server to handle persistent connections (not HTTP traffic) with an upper limit of about 250 simultaneous connections. Each connection typically uses about 5-10Kb/sec and the best possible latency in handling traffic is crucial. As it stands I am using the Poco SocketReactor which uses the Reactor model with a select() call at its heart however I have had a read on the C10K problem as well as few other resources and it seems that using this approach might not be the best idea. I believe there is a test implementation in the Poco libs that uses poll() so this could be an option to improve things. Does anyone have any experience using a Poco SocketReactor and do you have any idea how well it might scale for my scenario? If it will not scale well, suggestions on alternatives would be appreciated.

    Read the article

  • Efficiently Determine if EF 4 POCO Already in ObjectSet

    - by Eric J.
    I'm trying EF 4 with POCO's on a small project for the first time. In my Repository implementation, I want to provide a method AddOrUpdate that will add a passed-in POCO to the repository if it's new, else do nothing (as the updated POCO will be saved when SaveChanges is called). My first thought was to do this: public void AddOrUpdate(Poco p) { if (!Ctx.Pocos.Contains<Poco>(p)) { Ctx.Pocos.AddObject(p); } } However that results in a NotSupportedException as documented under Referencing Non-Scalar Variables Not Supported (bonus question: why would that not be supported?) Just removing the Contains part and always calling AddObject results in an InvalidStateException: An object with the same key already exists in the ObjectStateManager. The existing object is in the Unchanged state. An object can only be added to the ObjectStateManager again if it is in the added state. So clearly EF 4 knows somewhere that this is a duplicate based on the key. What's a clean, efficient way for the Repository to update Pocos for either a new or pre-existing object when AddOrUpdate is called so that the subsequent call to SaveChanges() will do the right thing? I did consider carrying an isNew flag on the object itself, but I'm trying to take persistence ignorance as far as practical.

    Read the article

  • Help with POCO library (Shared memory)

    - by sevaxx
    I was advised to use the POCO library for inter-process communication (IPC). Looks like a powerful library and there is some documentation in the code, but I would prefer a working example , since I am not very familiar with the IPC stuff. I 've been searching for some time now and I'm out of luck. If anyone has used POCO Shared Memory successfully in the past, I would love to see some sample code !

    Read the article

  • poco Lib dosnt compile in vs express 9

    - by user63898
    Hello all im trying to compile the poco lib in vs express 2008 but im keep getting this error : poco-1.3.6p2\foundation\src\eventlogchannel.cpp(40) : fatal error C1083: Cannot open include file: 'pocomsg.h': No such file or directory no i have the mc.exe in my sdk and all the paths in the IDE are seams to be right and nada . does any one have experience with this lib ?

    Read the article

  • Asp.net mvc, entity framework, Poco - Architecture

    - by user1576228
    I have a "small" enterprise application, aspnet mvc 3 + entity framework with POCO entity and repository pattern. I structured the solution in 4 projects: POCO entities Domain model Services web application When the application performs a query on the database, use one of the services provided, the service uses the repository and the small classes, as a result I have some dynamic proxy objects that I would like to convert in my domain entities, before using them in mvc views, but I do not know how. Dovrebber be set as the translator? This approach is reasonable?

    Read the article

  • EDM -> POCO -> WCF (.NET4) But transferring Collections causes IsReadOnly set to TRUE

    - by Gary B
    Ok, this may sound a little 'unorthodox', but...using VS2010 and the new POCO t4 template for Entity Framework (http://tinyurl.com/y8wnkt2), I can generate nice POCO's. I can then use these POCO's (as DTO's) in a WCF service essentially going from EDM all the way through to the client. Kinda what this guys is doing (http://tinyurl.com/yb4bslv), except everything is generated automatically. I understand that an entity and a DTO 'should' be different, but in this case, I'm handling client and server, and there's some real advantages to having the DTO in the model and automatically generated. My problem is, that when I transfer an entity that has a relationship, the client generated collection (ICollection) has the read-only value set, so I can't manipulate that relationship. For example, retrieving an existing Order, I can't add a product to the Products collection client-side...the Products collection is read-only. I would prefer to do a bunch of client side 'order-editing' and then send the updated order back rather than making dozens of server round trips (eg AddProductToOrder(product)). I'd also prefer not to have a bunch of thunking between Entity and DTO. So all-in-all this looks good to me...except for the read-only part. Is there a solution, or is this too much against the SOA grain?

    Read the article

  • .Net Entity Framework & POCO ... querying full table problem

    - by Chris Klepeis
    I'm attempting to implement a repository pattern with my poco objects auto generated from my edmx. In my repository class, I have: IObjectSet<E> _objectSet; private IObjectSet<E> objectSet { get { if (_objectSet == null) { _objectSet = this._context.CreateObjectSet<E>(); } return _objectSet; } } public IQueryable<E> GetQuery(Func<E, bool> where) { return objectSet.Where(where).AsQueryable<E>(); } public IList<E> SelectAll(Func<E, bool> where) { return GetQuery(where).ToList(); } Where E is the one of my POCO classes. When I trace the database and run this: IList<Contact> c = contactRepository.SelectAll(r => r.emailAddress == "[email protected]"); It shows up in the sql trace as a select for everything in my Contact table. Where am I going wrong here? Is there a better way to do this? Does an objectset not lazy load... so it omitted the where clause? This is the article I read which said to use objectSet's... since with POCO, I do not have EntityObject's to pass into "E" http://devtalk.dk/CommentView,guid,b5d9cad2-e155-423b-b66f-7ec287c5cb06.aspx

    Read the article

  • POCO Best Practice

    - by Paul Johnson
    All, I have a series of domain objects (project is NHibernate based). Currently as per 'good practice' they define only the business objects, comprising properties and methods specific to each objects function within the domain. However one of the objects has a requirement to send an SMTP message. I have a simple SMTP client class defined in a separate 'Utilities' assembly. In order to use this mail client from within the POCO, I would need to hold a reference to the utilities assembly in the domain. My query is this... Is it a departure from best practice to hold such a reference in a POCO, for the purpose of gaining necessary business functionality. Kind Regards Paul J.

    Read the article

  • Persisting details in Master Detail relation EF4 POCO

    - by Roger Alsing
    Scenario: Entity Framework 4 , POCO templates and Master Detail relation. Lets say I have a master type like this: //partial implementation of master entity partial class Master { public void AddDetail(x,y,z) { var detail = new Detail() { X = x, Y = y, Z = z, }; //add the detail to the master this.Details.Add(detail); } } If I then add a master instance to my context and commit, the details will not be saved: var masterObject = new Master(); masterObject.AddDetail(1,2,3); myContext.MasterSet.AddObject(masterObject); Is there any way to make the details to be persisted by reachabillity when using POCO templates? Or any other way? the Details collection in the Master entity is a FixUpCollection, so it ought to track the changes IMO. So, any ideas how to make this work W/O killing the POCO'ness too much?

    Read the article

  • EF4 POCO WCF Serialization problems (no lazy loading, proxy/no proxy, circular references, etc)

    - by kdawg
    OK, I want to make sure I cover my situation and everything I've tried thoroughly. I'm pretty sure what I need/want can be done, but I haven't quite found the perfect combination for success. I'm utilizing Entity Framework 4 RTM and its POCO support. I'm looking to query for an entity (Config) that contains a many-to-many relationship with another entity (App). I turn off lazy loading and disable proxy creation for the context and explicitly load the navigation property (either through .Include() or .LoadProperty()). However, when the navigation property is loaded (that is, Apps is loaded for a given Config), the App objects that were loaded already contain references to the Configs that have been brought to memory. This creates a circular reference. Now I know the DataContractSerializer that WCF uses can handle circular references, by setting the preserveObjectReferences parameter to true. I've tried this with a couple of different attribute implementations I've found online. It is needed to prevent the "the object graph contains circular references and cannot be serialized" error. However, it doesn't prevent the serialization of the entire graph, back and forth between Config and App. If I invoke it via WcfTestClient.exe, I get a stackoverflow (ha!) exception from the client and I'm hosed. I get different results from different invocation environments (C# unit test with a local reference to the web service appears to work ok though I still can drill back and forth between Configs and Apps endlessly, but calling it from a coldfusion environment only returns the first Config in the list and errors out on the others.) My main goal is to have a serialized representation of the graph I explicitly load from EF (ie: list of Configs, each with their Apps, but no App back to Config navigation.) NOTE: I've also tried using the ProxyDataContractResolver technique and keeping the proxy creation enabled from my context. This blows up complaining about unknown types encountered. I read that the ProxyDataContractResolver didn't fully work in Beta2, but should work in RTM. For some reference, here is roughly how I'm querying the data in the service: var repo = BootStrapper.AppCtx["AppMeta.ConfigRepository"] as IRepository<Config>; repo.DisableLazyLoading(); repo.DisableProxyCreation(); //var temp2 = repo.Include(cfg => cfg.Apps).Where(cfg => cfg.Environment.Equals(environment)).ToArray(); var temp2 = repo.FindAll(cfg => cfg.Environment.Equals(environment)).ToArray(); foreach (var cfg in temp2) { repo.LoadProperty(cfg, c => c.Apps); } return temp2; I think the crux of my problem is when loading up navigation properties for POCO objects from Entity Framework 4, it prepopulates navigation properties for objects already in memory. This in turn hoses up the WCF serialization, despite every effort made to properly handle circular references. I know it's a lot of information, but it's really standing in my way of going forward with EF4/POCO in our system. I've found several articles and blogs touching upon these subjects, but for the life of me, I cannot resolve this issue. Feel free to simply ask questions and help me brainstorm this situation. PS: For the sake of being thorough, I am injecting the WCF services using the HEAD build of Spring.NET for the fix to Spring.ServiceModel.Activation.ServiceHostFactory. However I don't think this is the source of the problem.

    Read the article

  • EF 4, POCO and AddOrUpdate

    - by Eric J.
    I'm trying to create a method on an EF 4 POCO repository called AddOrUpdate. The idea is that the business layer can pass in a POCO object and the persistence framework will add the object if it is new (not yet in the database), else will update the database (once SaveChanges() is called) with the new value. This is similar to some other questions I have asked about EF, but I'm only about 80% there in understanding this so please forgive partial duplication. The part I'm missing is how to update the object graph in my ObjectContext/associated ObjectSet for the passed-in business object once I have determined that the business object indeed already exists in the database (and now has been loaded thanks to TryGetObjectByKey). ApplyCurrentValues sounds sort of like what I want, but it only copies scalar values and doesn't seem intended to update the object graph in the ObjectContext/ObjectSet. Because of my particular use case I don't care about concurrency right now. public void AddOrUpdate(BO biz) { object obj; EntityKey ek = Ctx.CreateEntityKey(mySetName, biz); bool found = Ctx.TryGetObjectByKey(ek, out obj); if (found) { // How do I do what this method name implies? Biz is a parent with children. mySet.TellTheSetToUpdateThisObject(biz); } else { mySet.AddObject(biz); } Ctx.DetectChanges(); }

    Read the article

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

    - by Brian McCord
    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.jeremyskinner.co.uk/2010/02/22/using-fluentvalidation-with-an-ioc-container/ My problem comes in when I try to use Html.EditorForModel or EditorFor on a view. When I try to do that I get this error message: No component for supporting the service FluentValidation.IValidator`1[[System.Data.Entity.DynamicProxies.State_71C51A42554BA6C3CF05105DA05435AD209602C217FC4C34CA52ACEA2B06B99B, EntityFrameworkDynamicProxies-BrindleyInsurance.BusinessObjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] was found This is due to using the POCO generation on Entity Framework 4.0. At runtime, the generated classes get wrapped with a Dynamic Proxy so tracking and lazy loading can happen. Apparently, when using EditorForModel or EditorFor, it tries to ask Windsor to create a validator for the dynamic proxy type instead of the underlying real type. Does anyone know what I can do to solve this issue?

    Read the article

  • Entity Framework 4 / POCO - Where to start?

    - by Basiclife
    Hi, I've been programming for a while and have used LINQ-To-SQL and LINQ-To-Entities before (although when using entities it has been on a Entity/Table 1-1 relationship - ie not much different than L2SQL) I've been doing a lot of reading about Inversion of Control, Unit of Work, POCO and repository patterns and would like to use this methodology in my new applications. Where I'm struggling is finding a clear, concise beginners guide for EF4 which doesn't assume knowledge of EF1. The specific questions I need answered are: Code first / model first? Pros/cons in regards to EF4 (ie what happens if I do code first, change the code at a later date and need to regenerate my DB model - Does the data get preserved and transformed or dropped?) Assuming I'm going code-first (I'd like to see how EF4 converts that to a DB schema) how do I actually get started? Quite often I've seen articles with entity diagrams stating "So this is my entity model, now I'm going to ..." - Unfortunately, I'm unclear if they're created the model in the designer, saved it to generate code then stopped any further auto-code generation -or- They've coded (POCO)? classes and the somehow imported them into the deisgner view? I suppose what I really need is an understanding of where the "magic" comes from and how to add it myself if I'm not just generating an EF model directly from a DB. I'm aware the question is a little vague but I don't know what I don't know - So any input / correction / clarification appreciated. Needless to say, I don't expect anyone to sit here and teach me EF - I'd just like some good tutorials/forums/blogs/etc. for complete entity newbies Many thanks in advance

    Read the article

  • C# POCO T4 template, generate interfaces?

    - by Jonna
    Does anyone know of any tweaked version of POCO T4 template that generates interfaces along with classes? i.e. if I have Movie and Actor entities in .edmx file, I need to get the following classes and interfaces. interface IMovie { string MovieName { get; set; } ICollection<IActor> Actors { get; set; } //instead of ICollection<Actor> } class Movie : IMovie { string MovieName { get; set; } ICollection<IActor> Actors { get; set; } //instead of ICollection<Actor> } interface IActor { string ActorName { get; set; } } class Actor { string ActorName { get; set; } } Also, just in case I write my own entities, does POCO proxies(I need them for lazy loading) work with the interface declarations as shown above?

    Read the article

  • EF4 POCO Not Updating Navigation Property On Save

    - by Gavin Draper
    I'm using EF4 with POCO objects the 2 tables are as follows Service ServiceID, Name, StatusID Status StatusID, Name The POCO objects look like this Service ServiceID, Status, Name Status StatusID, Name With Status on the Service object being a Navigation Property and of type Status. In my Service Repository I have a save method that takes a service objects attaches it to the context and calls save. This works fine for the service, but if the status for that service has been changed it does not get updated. My Save method looks like this public static void SaveService(Service service) { using (var ctx = Context.CreateContext()) { ctx.AttachModify("Services", service); ctx.AttachTo("Statuses",service.Status); ctx.SaveChanges(); } } The AttachModify method attaches an object to the context and sets it to modified it looks like this public void AttachModify(string entitySetName, object entity) { if (entity != null) { AttachTo(entitySetName, entity); SetModified(entity); } } public void SetModified(object entity) { ObjectStateManager.ChangeObjectState(entity, EntityState.Modified); } If I look at a SQL profile its not even including the navigation property in the update for the service table, it never touches the StatusID. Its driving me crazy. Any idea what I need to do to force the Navigation Property to update?

    Read the article

  • Convert a custom config class into POCO

    - by BozoJoe
    Given a set custom configuration classes based off ConfigurationElement I want to convert the custom class into a POCO object graph. Could reflection and LINQ extension methods give me an object which removes the ConfigurationElement inheritance?

    Read the article

  • Convert in memory POCO objects to c# code to initialize

    - by sidesinger
    Is there a library or code sample for converting an in memory POCO c# object to a .cs code file that creates that object. An example: object of type car in memory becomes: Car c = new Car { Name = "mazda", Id = 5, Passengers = new List<string> { "Bob", "Sally" } // etc... recursing to the bottom }; I could assume it could only set public properties.

    Read the article

  • Define 'poco'?

    - by saku
    Can someone define what exactly 'poco' means? I've encountering the term more and more often and I'm wondering is it only about plain classes or it mean something more?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >