poco

How to get around “Internal .NET Framework Data Provider error 1025.”?

删除回忆录丶 提交于 2019-11-30 05:43:27
问题 I am using the Entity Framework 4.3, POCO, database first and I am getting the following error: Internal .NET Framework Data Provider error 1025. QUESTION: I think that my query expresses my intent but I seem to be hitting this error, so I am wondering if anyone knows how I could structure my query differently to get around this error? Here is the scenario... I have a SQL server 2008 database that has 2 tables - A and B: A AId (int - not null - identity - primary key) AName (nvarchar(10) -

How would I know if I should use Self-Tracking Entities or DTOs/POCOs?

╄→гoц情女王★ 提交于 2019-11-30 05:29:53
What are some questions I can ask myself about our design to identify if we should use DTOs or Self-Tracking Entities in our application? Here's some things I know of to take into consideration: We have a standard n-tier application with a WPF/MVVM client, WCF server, and MS SQL Database. Users can define their own interface, so the data needed from the WCF service changes based on what interface the user has defined for themselves Models are used on both the client-side and server-side for validation. We would not be binding directly to the DTO or STE Some Models contain properties that get

Many-To-Many Relationship in Code-First EF4

偶尔善良 提交于 2019-11-30 05:12:47
How do you represent a many-to-many relationship in the EF4 Code-First CTP3? For example if I have the following classes: class User { public int Id { get; set; } public string Name { get; set; } public ICollection<Profile> Profiles { get; set; } } class Profile { public int Id { get; set; } public string Name { get; set; } } In the database there is a UserProfiles table that has the FK for User and FK for Profile. How can I map this? EDIT: I understand how to to currently map with having a ICollection<User> property on the Profile , but I really don't want to have a an opposite navigation

Domain Entities, DTO, and View Models

可紊 提交于 2019-11-30 04:56:26
I have an ASP.NET MVC 2 application with a POCO domain model and an NHibernate repository layer. My domain model has no awareness of my viewmodels so I use automapper to go from viewmodel to entity and vice/versa. When I introduced WCF to my project (a late requirement), I started having to deal with disconnected objects. That is, I retrieve an entity from the database with NHibernate and once that entity is serialized it becomes disconnected and each child collection is loaded regardless of whether or not I plan on using it meaning I'm doing alot of unnecessary database work. After reading up

Using ADO.net Entity Framework 4 with Enumerations? How do I do it?

雨燕双飞 提交于 2019-11-30 04:25:43
问题 Question 1: I am playing around with EF4 and I have a model class like : public class Candidate { public int Id {get;set;} public string FullName {get;set;} public Gender Sex {get;set;} public EducationLevel HighestDegreeType {get;set;} } Here Gender and EducationLevel are Enums like: public enum Gender {Male,Female,Undisclosed} public enum EducationLevel {HighSchool,Bachelors,Masters,Doctorate} How do I get the Candidate Class and Gender and EducationLevel working with EF4 if: I do model

how to manage _id field when using POCO with mongodb c# driver

浪子不回头ぞ 提交于 2019-11-30 02:56:19
If I want to read and write mongo data with a POCO public class Thingy { public string Foo {get;set;} } ... coll.Insert(new Thing(Foo = "hello")); When I read back I get a failure saying that _id is an unexpected attribute (which it is). So then I added a field called _id to the class. Now the insert doesnt work saying that the _id field cannot be null. A tried BsonIgnoreIfNull attribute, that didnt work. When you insert an object, if it doesn't have an _id field then the driver adds one and sets it to a 12-byte MongoDB ObjectId value. You just need to add an Id property to your POCO, which

EF Code First - Recreate Database If Model Changes

♀尐吖头ヾ 提交于 2019-11-30 00:34:35
I'm currently working on a project which is using EF Code First with POCOs. I have 5 POCOs that so far depends on the POCO "User". The POCO "User" should refer to my already existing MemberShip table "aspnet_Users" (which I map it to in the OnModelCreating method of the DbContext). The problem is that I want to take advantage of the "Recreate Database If Model changes" feature as Scott Gu shows at: http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx - What the feature basically does is to recreate the database as soon as it sees any changes in

EF with POCO + WCF + WPF. Reuse POCO classes on client or use DTOs?

梦想与她 提交于 2019-11-29 23:12:59
问题 We are developing a 3-tier application with a WPF client, which communicates through WCF with the BLL. We use EF to access our database. We have been using the default EntityObject code generator of EF, but had lots of problems and serialization issues when sending those object through the wire, and when processing and reattaching them in the BLL. We are about to switch to the POCO template, and rewrite the data access and the communication parts of our app (we are hoping to have a cleaner

OptimisticConcurrencyException Does Not Work in Entity Framework In Certain Situations

女生的网名这么多〃 提交于 2019-11-29 23:06:56
UPDATE (2010-12-21): Completely rewrote this question based on tests that I've been doing. Also, this used to be a POCO specific question, but it turns out that my question isn't necessarily POCO specific. I'm using Entity Framework and I've got a timestamp column in my database table that should be used to track changes for optimistic concurrency. I've set the concurrency mode for this property in the Entity Designer to "Fixed" and I'm getting inconsistent results. Here are a couple of simplified scenarios that demonstrate that concurrency checking works in one scenario but not in another.

Python自动抢红包,超详细教程,再也不会错过微信红包了!

流过昼夜 提交于 2019-11-29 19:51:05
目录: 0 引言 1 环境 2 需求分析 3 前置准备 4 抢红包流程回顾 5 代码梳理 6 后记 0 引言 提到抢红包,就不得不提Xposed框架,它简直是个抢红包的神器,但使用Xposed框架有一个前提条件:手机需要root,对于苹果手机的话就需要越狱了。现在的手机想要root或越狱并不容易,同时这会对手机安全性带来一些风险,抢红包本身只是个娱乐活动,这样做就得不偿失了。 为了自动抢红包,python能帮我们实现吗? 答案是肯定的,本文就带大家一起探索下用Python如何实现自动抢红包。 1 环境 操作系统:Windows Python版本:3.7.2 手机系统:Android 2 需求分析 这里我们的需求是实现自动抢红包。首先要打开微信,进入到指定的群聊,识别微信红包、执行抢红包的动作。这就是关键的步骤,简单清晰。 因为电脑版本的微信没有抢红包的功能,我们只能手机微信,那么就需要把手机连上电脑,通过电脑控制手机来自动抢,那就需要确保「adb」命令可正常执行。 识别微信中的消息,是红包还是普通的信息,这里我们通过聊天消息的元素标识来判断。这里我们借助了「Airtest IDE」工具来实现。 3 前置准备 3.1 打开手机的USB调试 要正常使用「adb」需要打开USB调试,设置项通常出现在手机系统设置中的[开发人员选项]里面。 在手机上打开USB调试后