entity-framework-4

SQL CE 3.5 & EntityFramework

本秂侑毒 提交于 2019-12-25 03:05:40
问题 I have an sqlce 3.5 local db file in my VS2010 solution used with an EF4 Model. I need to protect my db with a password but do not serialize it in app.config. I also need to set up the maximum database file size to it's maximum allowed value which is 4091 MB when I try to set the connectionString in code, I can't find a way to set the 'Max Database Size=4091'. Here is a method that I use to build the connection string private string GetConnectionString() { // Specify the provider name, server

Undo / Redo with change tracking in Entity Framework

别来无恙 提交于 2019-12-25 02:02:05
问题 I'm trying to implement an Undo / Redo feature based on entity framework with POCO entities. Therefor after each change that I want to track I call the ChangeTracker for any modification to entities an I call the ObjectStateManger for changes to relationships (i.e. navigation properties). I store all the changes with the current and previous values to be able to go back and forth in the history. My problem now is that for entities with a navigation property and a corresponding foreign key

How do I correctly use EF4 Navigation Properties?

泄露秘密 提交于 2019-12-25 01:23:14
问题 I've created a database using the EF4 model-first approach. In my model, there's an N-to-M relationship between two entities: I've filled my database with some dummy data, including 3 records of type Diagnosis and 3 records of type TreatmentSchema and associations between them. Here's the code snippet I used to do this: using(var container = new SmartTherapyContainer()) { var diagnosisA = new Diagnosis() { Id = Guid.NewGuid(), Name = "Diagnosis A" }; var diagnosisB = new Diagnosis() { Id =

Entity Framework 4.1 - Code first. Doesn't EF override my virtual members?

我与影子孤独终老i 提交于 2019-12-25 00:30:00
问题 I’m building a system using domain driven design and EF 4.1. In some of my properties I have logic preventing illegal values to be set and if so throwing an exception. I thought EF, when instantiating my classes, created a new temporary class e.g. MyClass_abc123… inheriting from MyClass that overrides all virtual members to be able to set them with data from the DB. When EF instantiates the class below and try to set the property MyObj the exception is being thrown. Anyone got a clue or a

Entity Framework 4.3 Hosted SQL Server No Database Create Permissions

此生再无相见时 提交于 2019-12-25 00:25:12
问题 My SQL Server is hosted by my hosting provider. This means that I don't have permission to recreate (or create) the database. This is causing me a problem with EF 4 - it thinks the tables are missing, which they are. I think is caused by not being able to recreate the database. To recap: developed locally, moving to hosted server for first time run, switched the connection string, run against the hosted server, error saying Invalid object name 'dbo.Products'. I have permission to create

tiny custom role management for asp.net mvc 3

a 夏天 提交于 2019-12-24 23:23:16
问题 I chose to do a school project with asp.net mvc3 and there is a need of a user/role management. I think the membership that ships with asp.net is way too big for a school projec. SO my thought is this. if i could find an equivalent of Zend predispatch method for asp or even a better one i could store the urls accessible as privilege for a role and load it in session and check if a particular user have access to it and redirect if not. my question are this: Is there any equivalent of

Comboboxcolumn created using the designer

对着背影说爱祢 提交于 2019-12-24 22:25:11
问题 This is the first time I've tried to use comboboxcolumn in a datagridview (WinForms, C#, EF4). With the designer, I created a datagridview to show the orders table, and inside the datagrid a comboboxcolumn to show the customer names from the customers table, this column has now the properties below: Data: DataPropertyName: CustomerID DataSorce: customerBindingSource DisplayMember: CompanyName ValueMember: CustomerID Design: (Name): Cbo ColumnType: DataGridViewComboBoxColumn Then I entered the

Error Saving ViewState in Entity Framework

蹲街弑〆低调 提交于 2019-12-24 19:28:16
问题 I am working in .NET Entity Framework 4.0 I am using viewstate to save an entity. And I have serialize that entity as well. But when I try to save data to viewstate, getting this error: Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Error serializing value 'System.Collections.Generic.List`1[Pc.PrecisionCare2.ModelTypes.Medication]' of type 'System.Collections.Generic.List`1[[Pc.PrecisionCare2.ModelTypes.Medication, PrecisionCare2ModelTypes, Version=1.0.0

MVC Model on Post has no navigation properties

余生颓废 提交于 2019-12-24 19:22:41
问题 I've looked around SO and I can't find anyone with an issue like this, so I'm posting this question. I have a two edit actions in a controller (post and get) and in the GET I populate the Wine property of a viewmodel that gets passed to the view. On the POST, I read that viewmodel, and save the changes to the database. After that I wanted to update my Lucene seach index with the updated Wine property. However, I keep getting an error because the Wine property doesn't have any of its

Get serialization error when try and submit EF4 entity via WCF

荒凉一梦 提交于 2019-12-24 19:15:09
问题 I have an entity CustomerActivityReport which I'm trying to submit to the server via WCF. On the server end I'm using the repository + UOW patterns to update/insert the entity into the db. CustomerActivityReport has a many to many relationship to another entity LookupValue. When I try and submit an instance of CustomerActivityReport, the DataContractSerializer throws the error: "Object graph for type 'FixupCollection[CustomerActivityReport]' contains cycles and cannot be serialized if