entity-framework

“Read-Only” Entity Framework? I'm trying to use RIA Services, EF, and Silverlight

和自甴很熟 提交于 2020-01-14 04:14:18
问题 I'm trying to present MySQL server data in a silverlight client and my current plan of attack is to use Entity Framework to MySQL with RIA Services providing the data access between the Silverlight Client and Entity Framework. However, I'm only trying to present data to the user and I do not want the possibility of me or someone else being able to change the data in MySQL. In short, I wish there was a way to simply ignore the setters for all entity types. I only want getters. I want "read

Use tuples with Entity Framework Contains statement

江枫思渺然 提交于 2020-01-14 04:09:15
问题 I have an entity whose reference is a composite of an identifier and an environment. I want to implement a function to allow the user to pass a list of tuples of (ID, Environment) and return back the required entities. Is it possible to use Contains() in such scenarios? How? With a simple reference, it is as simple as model.MyEntities.Where(e => myIds.Contains(e.Id)) EDIT : To clarify, I am not looking for how to use Contains() method to retrieve a list of IDs; the line I wrote above does

Binding DataGridView to database with EF5 classes not sending changes to database

两盒软妹~` 提交于 2020-01-14 03:59:12
问题 I am using Entity Framework 5.0 + .NET 4.5 I have created database using EF Model first approach and I want to bind DataGridView to database using EF classes so that any changes to database or in the DataGridView are synchronized automatically. This is my code: //form level fields private BindingList<Product> _products; private BindingSource _productSource = new BindingSource(); ... in the form load event //load the data from database using EF classes var tmp = _context.BaseCategorySet.OfType

Can you create a database without migrations in EF5?

和自甴很熟 提交于 2020-01-14 03:35:13
问题 I am following the offical asp.net "Getting started with EF 5 using MVC 4". In that tutorial, the database is created when the migrations are performed(in my understanding). When I was looking at the EF 5 with Mvc 5 tutorial they didn't use migrations to create a database. They use database initializer. So, I was wondering could create a database for your project without using migrations in EF 5? Also, what would the difference be with both these approaches? 回答1: Code first Migrations and

How do I override DeleteObject in Entity Framework

。_饼干妹妹 提交于 2020-01-14 03:28:09
问题 Hi i'm totally new to EF and i'm having difficulties getting my head around it but heres the scenario. I've created a project and added a edmx diagram which i've used to generate models from a pre-built SQL database. That dame diagram has generated code for each model an a context for me. the context looks something like : public partial class BuzzEntities : ObjectContext { public ObjectSet<Case> Cases { get { if ((_Cases == null)) { _Cases = base.CreateObjectSet<Case>("Cases"); } return

Severe performance problems when performing a simple query using Entity Framework

若如初见. 提交于 2020-01-14 03:13:08
问题 I've got a fairly generic CRUD webapp, which generates pages dynamically according to the contents of several database tables. I'm using Entity Framework 4.0 to pull this data out of the DB, however I'm running into severe performance problems. I've managed to iterate down into a problem which is contained enough that I can detail below. I have a table containing list of Page Forms (~200). Each form has one or more Fields (~4000 total), and each field has may have some Parameters (~16000

Passing list from view to controller, MVC3

北战南征 提交于 2020-01-14 03:10:25
问题 I'm trying to create a tagging system for my project. I need the pass a string (for ex: "test1, test2, test3") which will be binded to an entity as a list. I'm using EF and my view inherits an entity, defined in EF. Without creating a view model, is it possible to do that? 回答1: Quite honestly view models is the way to go here. But because you asked I will try to answer. IIRC EF models are partial classes, meaning that you could add properties to them, like this: public partial class MyEFModel

Using Oracle with EF code first

北战南征 提交于 2020-01-14 03:04:28
问题 I wrote a project with EF code first 6 and SQL Server 2008R2 for a company, Now the company wants to switch its DB to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 , How could I find appropriate version of ODP.NET or ODAC ? Could I use ODAC 12c or any other versions for Oracle 10g or each Oracle version has its own ODAC version? 回答1: You could just rely on the last version of odp.net managed driver but beware that some features might not be available on your 10g (like APPLY)

bulk insert and update with ADO.NET Entity Framework

て烟熏妆下的殇ゞ 提交于 2020-01-14 03:00:07
问题 I am writing a small application that does a lot of feed processing. I want to use LINQ EF for this as speed is not an issue, it is a single user app and, in the end, will only be used once a month. My questions revolves around the best way to do bulk inserts using LINQ EF. After parsing the incoming data stream I end up with a List of values. Since the end user may end up trying to import some duplicate data I would like to "clean" the data during insert rather than reading all the records,

How to exclude some column from .edmx file, *.csdl ,*.msdl, and *.ssdl dynamically using Database first Approach

懵懂的女人 提交于 2020-01-14 02:29:08
问题 what i am trying to do is exclude few column from EF store and EF modal. for reference there are two method : https://stackoverflow.com/a/40742144/4998968 but i want to exclude column when edmx file is created i.e when i connect my database using Ado.net Data modal option i want few columns to be excluded from edmx as if they don't exists in database. currently i am exploring the entity framework source code but cannot find the exact code that generates .edmx file and store. example: suppose