poco

How to write a custom POCO serializer/deserializer?

与世无争的帅哥 提交于 2019-12-08 19:36:28
问题 I would like to write a custom .NET serializer/deserializer for FIX messages (which aren't like XML). Basically the message is coded as <tag>=<value>;<tag>=<value>;... So a sample one might be: 51=2;20=hello;31=2 I would like to use my FIX Serializer class similar to the way I use the XMLSerializer class to be able to serialize/deserialize messages. I would imagine I would write a FIX message class like: [Serializable] public class FixMessage { [FIXValuePair(51)] public double Price { get;

The entity type [xxx] is not part of the model for the current context

放肆的年华 提交于 2019-12-08 12:52:40
问题 Blockquote I been going at this problem for a few days now. I'm trying to create a db connection using Visual Studio 2010 MVC2 EF 6.0. I can connect to the DB using the server explorer. Here is what I done so far: Created a Model: ModelEntities.edmx (connects to a SQL Server DB) 2. Created a Model for the table I'm trying to access: Table.cs ( has all the public members) public class Quickfix { public int FIX_ID { get; set; } public string NAME { get; set; } public string TYPE { get; set; }

How to get EF POCOs from System.Data.Entities.DynamicProxies

。_饼干妹妹 提交于 2019-12-08 11:58:18
问题 My question is the same as this one However, I don't really see a solution there. Lets say I have a simple model with two POCOs, Country and State. public class Country { public string Code { get; set; } public string Name { get; set; } } public class State { public string Code { get; set; } public string Name { get; set; } public virtual Country Country { get; set; } } When I use the repository to .GetStateByCode(myCode), it retrieves a dynamic proxy object. I want to send that over the wire

Entity Framework 4 POCO entities in separate assembly, Dynamic Data Website?

夙愿已清 提交于 2019-12-08 11:37:50
问题 Basically I want to use a dynamic data website to maintain data in an EF4 model where the entities are in their own assembly. Model and context are in another assembly. I tried this Entity Framework 4 + Self-Tracking Entities + ASP.NET Dynamic Data = Error but get an "ambiguous match" error from reflection: System.Reflection.AmbiguousMatchException was unhandled by user code Message=Ambiguous match found. Source=mscorlib StackTrace: at System.RuntimeType.GetPropertyImpl(String name,

Windows Phone 8 MVVM Database First (like EF)

隐身守侯 提交于 2019-12-08 11:28:28
Is there any framework for Windows Phone 8 which is similar in use to Entity Framework for generating POCOS from an existing database? LINQ to SQL: A SQL Server Compact database combined with my SQL Server Compact Toolbox for the code generation. If you have VS Express, you can use the standalone edition, download from http://sqlcetoolbox.codeplex.com 来源: https://stackoverflow.com/questions/18482525/windows-phone-8-mvvm-database-first-like-ef

Custom Data Access in EF for POCO

不问归期 提交于 2019-12-08 07:50:50
问题 I am currently writing a WCF data service that is meant to extract data from any database in a predefined standard structure. I was thinking of using POCO entities. I can design my entities on EF designer and generate the POCO classes from it but the bit I struggling to understand is how to write data access layer and inject it into the DBContext. So for each different database, I'll have a data access layer that will retrieve data from a database or even an xml file and map the data to my

How to Clone POCO entity and add to context

拜拜、爱过 提交于 2019-12-08 07:39:18
问题 I am using EF4 and I have create POCO objects with proxies from my database structure . I have a POCO (object) which has lots of relationships to other entities. I created a deep copy of the object using DataContractSerializer and BinaryFormatter and lets call it clonedObject. function used for cloning is: public T CloneProxy<T>(T source) { var dcs = new System.Runtime.Serialization .DataContractSerializer(typeof(T)); string filePath = "Initiative.txt"; using (FileStream file = new FileStream

Table per hierarchy inheritance with POCO entities in Entity Framework 4

巧了我就是萌 提交于 2019-12-08 07:28:33
问题 Our organization is looking to standardize on Entity Framework once v4 comes out. As a result, I am looking at what it would take to migrate our application that uses NHibernate for persistence to EF4 using POCO support. In a couple of places we use single table inheritance (also known as Table Per Hierarchy). I have been unable to get it to work using the following. Payment (base class [should be abstract but having trouble there as well]) CreditCardPayment (concrete implementation)

Are navigation properties read each time they are accessed? (EF4.1)

此生再无相见时 提交于 2019-12-08 06:37:58
问题 I am using EF 4.1, with POCOs which are lazy loaded. Some sample queries that I run: var discountsCount = product.Discounts.Count(); var currentDiscountsCount = product.Discounts.Count(d=>d.IsCurrent); var expiredDiscountsCount = product.Discounts.Count(d=>d.IsExpired); What I'd like to know, is whether my queries make sense, or are poorly performant: Am I hitting the database each time, or will the results come from cached data in the DbContext? Is it okay to access the navigation properties

How to add compiler options in Eclipse IDE

只愿长相守 提交于 2019-12-08 05:47:45
问题 I'm creating an application that interfaces with a weather API, and to do so I'm using Poco's HTTPClientSession library, but I'm getting an error at compile time Undefined symbols for architecture x86_64: "Poco::Net::HTTPRequest::setHost(std::__1::basic_string<char,std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from: Weather::getCSV() in Weather.o "Poco::Net::HTTPRequest::HTTPRequest()", referenced from: Weather::getCSV() in Weather.o "Poco::Net::HTTPRequest::