Search Results

Search found 231 results on 10 pages for 'ef4'.

Page 4/10 | < Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • Best practice for structuring a new large ASP.NET MVC2 plus EF4 VS2010 solution?

    - by Nick
    Hi, we are building a new web application using Microsoft ASP.NET MVC2 and Entity Framework 4. Although I am sure there is not one right answer to my question, we are struggling to agree a VS2010 solution structure. The application will use SQL Server 2008 with a possible future Azure cloud version. We are using EF4 with T4 POCOs (model-first) and accessing a number of third-party web-services. We will also be connecting to a number of external messaging systems. UI is based on standard ASP.NET (MVC) with jQuery. In future we may deliver a Silverlight/WPF version - as well as mobile. So put simply, we start with a VS2010 blank solution - then what? I have suggested 4 folders Data (the EF edmx file etc), Domain (entities, repositories), Services (web-services access), Presentation (web ui etc). However under Presentation, creating the ASP.NET MVC2 project obviously creates it's own Models folder etc and it just doesn't seem to fit too well in this proposed structure. I'm also missing a business layer (or does this sit in the domain?). Again I am sure there is no one right way to do it, but I'd really appreciate your views on this. Thanks

    Read the article

  • Why won't EF4 generate a method to support my Function Import?

    - by Deane
    I have a stored proc in my database which returns an integer. I added a Function Import to my model. This appears in the EDMX file: <Function Name="GetTotalEntityCount" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo" /> However, no method actually gets generated for this. It should be top level, right? using (MyContext context = new MyContext()) { context.MyMethodShouldBeRightHere(); } Nothing appears in Intellisense, I've gone through the designer.cs file and there's nothing in there, and reflected the DLL...nothing. The code generator is just not generating any code to support this stored proc. I added another table to my database and updated the model, and that came in, so the model will update, it's just specifically ignoring this stored proc. I've tried everything I can think of, and consulted every resource I can find, and as near as I can tell, I'm doing everything right. I'm using EF4, database-first. (I'm pretty sure on the version, anyway. This shows up in the generated file: Runtime Version:4.0.30319.1 )

    Read the article

  • EF4 Import/Lookup thousands of records - my performance stinks!

    - by Dennis Ward
    I'm trying to setup something for a movie store website (using ASP.NET, EF4, SQL Server 2008), and in my scenario, I want to allow a "Member" store to import their catalog of movies stored in a text file containing ActorName, MovieTitle, and CatalogNumber as follows: Actor, Movie, CatalogNumber John Wayne, True Grit, 4577-12 (repeated for each record) This data will be used to lookup an actor and movie, and create a "MemberMovie" record, and my import speed is terrible if I import more than 100 or so records using these tables: Actor Table: Fields = {ID, Name, etc.} Movie Table: Fields = {ID, Title, ActorID, etc.} MemberMovie Table: Fields = {ID, CatalogNumber, MovieID, etc.} My methodology to import data into the MemberMovie table from a text file is as follows (after the file has been uploaded successfully): Create a context. For each line in the file, lookup the artist in the Actor table. For each Movie in the Artist table, lookup the matching title. If a matching Movie is found, add a new MemberMovie record to the context and call ctx.SaveChanges(). The performance of my implementation is terrible. My expectation is that this can be done with thousands of records in a few seconds (after the file has been uploaded), and I've got something that times out the browser. My question is this: What is the best approach for performing bulk lookups/inserts like this? Should I call SaveChanges only once rather than for each newly created MemberMovie? Would it be better to implement this using something like a stored procedure? A snippet of my loop is roughly this (edited for brevity): while ((fline = file.ReadLine()) != null) { string [] token = fline.Split(separator); string Actor = token[0]; string Movie = token[1]; string CatNumber = token[2]; Actor found_actor = ctx.Actors.Where(a => a.Name.Equals(actor)).FirstOrDefault(); if (found_actor == null) continue; Movie found_movie = found_actor.Movies.Where( s => s.Title.Equals(title, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); if (found_movie == null) continue; ctx.MemberMovies.AddObject(new MemberMovie() { MemberProfileID = profile_id, CatalogNumber = CatNumber, Movie = found_movie }); try { ctx.SaveChanges(); } catch { } } Any help is appreciated! Thanks, Dennis

    Read the article

  • Entity Framework 4 missing features?

    - by Roger Alsing
    I'm well aware that similair topics have been brought up before e.g. http://stackoverflow.com/questions/1639043/entity-framework-4-vs-nhibernate But instead of arguments like: NHibernate have been around longer and is more mature EF4 is drag n drop and not enterprisy EF4 and LinqToSql are ... I would like to see a more detailed list of features that you consider missing from EF4. Personally, I think the lack of enum support is the biggest drawback of EF4.

    Read the article

  • Why do I get "Invalid Column Name" errors in EF4?

    - by camainc
    I am trying to learn Entity Framework 4.0. Disclaimer 1: I am brand new to Entity Framework. I have successfully used LinqToSQL. Disclaimer 2: I am really a VB.Net programmer, so the problem could be in the C# code. Given this code snippet: public int Login(string UserName, string Password) { return _dbContext.Memberships .Where(membership => membership.UserName.ToLower() == UserName.ToLower() && membership.Password == Password) .SingleOrDefault().PrimaryKey; } Why do you suppose I get "Invalid column name" errors? {"Invalid column name 'UserName'.\r\nInvalid column name 'Password'.\r\nInvalid column name 'UserName'.\r\nInvalid column name 'Password'."} Those column names are spelled and cased correctly. I also checked the generated code for the entity in question, and those columns are properties in the entity. The intellisense and code completion also puts the column names into the expression just as they are here. I am stumped by this. Any help would be much appreciated. https://docs.google.com/leaf?id=0B-xLbzoqGvXvNjBmZmNjNDAtY2RhNC00NDA2LWIxNzMtYjhjNTYxMDIyZmZl&hl=en

    Read the article

  • How can I use external expressions in Linq with EF4 (and LINQKit)?

    - by neo
    I want to separate out often used expressions in linq queries. I'm using Entity Framework 4 and also LINQKit but I still don't know how I should do it the right way. Let me give you an example: Article article = dataContainer.Articles.FirstOrDefault(a => a.Id == id); IEnumerable<Comment> comments = (from c in container.Comments where CommentExpressions.IsApproved.Invoke(c) select c); public static class CommentExpressions { public static Expression<Func<Module, bool>> IsApproved { get { return m => m.IsApproved; } } } Of course the IsApproved expression would be something much more complicated. The problem is that the Invoke() won't work because I didn't call .asExpandable() from LINQKit on container.Comments but I can't call it because it's just an ICollection instead of an ObjectSet. So my question is: Do I always have to go through the data context when I want to include external expressions or can I somehow use it on the object I fetched (Article)? Any ideas or best practices? Thanks very much! neo

    Read the article

  • ASP.NET MVC & EF4 Entity Framework - Are there any performance concerns in using the entities vs retrieving only the fields i need?

    - by Ant
    Lets say we have 3 tables, Users, Products, Purchases. There is a view that needs to display the purchases made by a user. I could lookup the data required by doing: from p in DBSet<Purchases>.Include("User").Include("Product") select p; However, I am concern that this may have a performance impact because it will retrieve the full objects. Alternatively, I could select only the fields i need: from p in DBSet<Purchases>.Include("User").Include("Product") select new SimplePurchaseInfo() { UserName = p.User.name, Userid = p.User.Id, ProductName = p.Product.Name ... etc }; So my question is: Whats the best practice in doing this? == EDIT Thanks for all the replies. [QUESTION 1]: I want to know whether all views should work with flat ViewModels with very specific data for that view, or should the ViewModels contain the entity objects. Real example: User reviews Products var query = from dr in productRepository.FindAllReviews() where dr.User.UserId = 'userid' select dr; string sql = ((ObjectQuery)query).ToTraceString(); SELECT [Extent1].[ProductId] AS [ProductId], [Extent1].[Comment] AS [Comment], [Extent1].[CreatedTime] AS [CreatedTime], [Extent1].[Id] AS [Id], [Extent1].[Rating] AS [Rating], [Extent1].[UserId] AS [UserId], [Extent3].[CreatedTime] AS [CreatedTime1], [Extent3].[CreatorId] AS [CreatorId], [Extent3].[Description] AS [Description], [Extent3].[Id] AS [Id1], [Extent3].[Name] AS [Name], [Extent3].[Price] AS [Price], [Extent3].[Rating] AS [Rating1], [Extent3].[ShopId] AS [ShopId], [Extent3].[Thumbnail] AS [Thumbnail], [Extent3].[Creator_UserId] AS [Creator_UserId], [Extent4].[Comment] AS [Comment1], [Extent4].[DateCreated] AS [DateCreated], [Extent4].[DateLastActivity] AS [DateLastActivity], [Extent4].[DateLastLogin] AS [DateLastLogin], [Extent4].[DateLastPasswordChange] AS [DateLastPasswordChange], [Extent4].[Email] AS [Email], [Extent4].[Enabled] AS [Enabled], [Extent4].[PasswordHash] AS [PasswordHash], [Extent4].[PasswordSalt] AS [PasswordSalt], [Extent4].[ScreenName] AS [ScreenName], [Extent4].[Thumbnail] AS [Thumbnail1], [Extent4].[UserId] AS [UserId1], [Extent4].[UserName] AS [UserName] FROM [ProductReviews] AS [Extent1] INNER JOIN [Users] AS [Extent2] ON [Extent1].[UserId] = [Extent2].[UserId] LEFT OUTER JOIN [Products] AS [Extent3] ON [Extent1].[ProductId] = [Extent3].[Id] LEFT OUTER JOIN [Users] AS [Extent4] ON [Extent1].[UserId] = [Extent4].[UserId] WHERE N'615005822' = [Extent2].[UserId] or from d in productRepository.FindAllProducts() from dr in d.ProductReviews where dr.User.UserId == 'userid' orderby dr.CreatedTime select new ProductReviewInfo() { product = new SimpleProductInfo() { Id = d.Id, Name = d.Name, Thumbnail = d.Thumbnail, Rating = d.Rating }, Rating = dr.Rating, Comment = dr.Comment, UserId = dr.UserId, UserScreenName = dr.User.ScreenName, UserThumbnail = dr.User.Thumbnail, CreateTime = dr.CreatedTime }; SELECT [Extent1].[Id] AS [Id], [Extent1].[Name] AS [Name], [Extent1].[Thumbnail] AS [Thumbnail], [Extent1].[Rating] AS [Rating], [Extent2].[Rating] AS [Rating1], [Extent2].[Comment] AS [Comment], [Extent2].[UserId] AS [UserId], [Extent4].[ScreenName] AS [ScreenName], [Extent4].[Thumbnail] AS [Thumbnail1], [Extent2].[CreatedTime] AS [CreatedTime] FROM [Products] AS [Extent1] INNER JOIN [ProductReviews] AS [Extent2] ON [Extent1].[Id] = [Extent2].[ProductId] INNER JOIN [Users] AS [Extent3] ON [Extent2].[UserId] = [Extent3].[UserId] LEFT OUTER JOIN [Users] AS [Extent4] ON [Extent2].[UserId] = [Extent4].[UserId] WHERE N'userid' = [Extent3].[UserId] ORDER BY [Extent2].[CreatedTime] ASC [QUESTION 2]: Whats with the ugly outer joins?

    Read the article

  • Is there any way to provide custom factory for .Net Framework creation Entities from EF4 ?

    - by ILICH
    There are a lot of posts about how cool POCO objects are and how Entity Framework 4 supports them. I decided to try it out with domain driven development oriented architecture and finished with domain entities that has dependencies from services. So far so good. Imagine my Products are POCO objects. When i query for objects like this: NorthwindContext db = new NorthwindContext(); var products = db.Products.ToList(); EF creates instances of products for me. Now I want to inject dependencies in my POCO objects (products) The only way I see is make some method within NorthwindContext that makes something like pseudo-code below: public List<Product> GetProducts(){ var products = database.Products.ToList(); container.BuildUp(products); //inject dependencies return products; } But what if i want to make my repository to be more flexible like this: public ObjectSet<Product> GetProducts() { ... } So, I really need a factory to make it more lazy and linq friendly. Please help !

    Read the article

  • Why do a small amount of add/deletes take several seconds in EF4?

    - by TomWij
    Using the Entity Framework 4. I have created a Code First database in the past and a piece of code needs to delete and add 16 objects, this takes 6 seconds each. That's 300+ ms for each query! The deletes/adds occur in a foreach scope and there is a SaveChanges() outside the foreach. In the above image you see that each takes 6 seconds, which is 34% of the time, for 16 calls. That doesn't sound normal to me... Why is this and how can I improve the performance? If there is no solution: Are there any workarounds I can use? It would be a pain to rewrite my project...

    Read the article

  • EF4 + STE: Reattaching via a WCF Service? Using a new objectcontext each and every time?

    - by Martin
    Hi there, I am planning to use WCF (not ria) in conjunction with Entity Framework 4 and STE (Self tracking entitites). If i understnad this correctly my WCF should return an entity or collection of entities (using LIST for example and not IQueryable) to the client (in my case silverlight) The client then can change the entity or update it. At this point i believe it is self tracking???? This is where i sort of get a bit confused as there are a lot of reported problems with STEs not tracking.. Anyway... Then to update i just need to send back the entity to my WCF service on another method to do the update. I should be creating a new OBJECTCONTEXT everytime? In every method? If i am creaitng a new objectcontext everytime in everymethod on my WCF then don't i need to re-attach the STE to the objectcontext? So basically this alone wouldn't work?? using(var ctx = new MyContext()) { ctx.Orders.ApplyChanges(order); ctx.SaveChanges(); } Or should i be creating the object context once in the constructor of the WCF service so that 1 call and every additional call using the same wcf instance uses the same objectcontext? I could create and destroy the wcf service in each method call from the client - hence creating in effect a new objectcontext each time. I understand that it isn't a good idea to keep the objectcontext alive for very long. Any insight or information would be gratefully appreciated thanks

    Read the article

  • Entity Framework 4 with Existing Domain Model

    - by ace
    Hi, Im currently looking at migrating from fluent nHibernate to ADO.Net Entity Framework 4. I have a project containing the domain model (pocos) which I was using for nHibernate mappings. Ive read in blogs that it is possible to use my existing domain model with EF4 but ive seen no examples of it. Ive seen examples of T4 code generation with EF4 but havent come accross an example which shows how to use existing domain model objects with EF4. Im a newby with EF4 and would like to see some samples on how to get this done. Thanks Aiyaz

    Read the article

  • EF4 CTP5 Conflicting changes detected. This may happen when trying to insert multiple entities with the same key.

    - by user658332
    hi, I am new to EF4 CTP5. I am just hanging at one problem.. I am using CodeFirst without Database, so when i execute application, it generated DB for me. here is my scenario, i have following Class structure... public class KVCalculationWish { public KVCalculationWish() { } public int KVCalculationWishId { get; set; } public string KVCalculationWishName { get; set; } public int KVSingleOfferId { get; set; } public virtual KVSingleOffer SingleOffer { get; set; } public int KVCalculationsForPersonId { get; set; } public virtual KVCalculationsForPerson CaculationsForPerson { get; set; } } public class KVSingleOffer { public KVSingleOffer() { } public int KVSingleOfferId { get; set; } public string KVSingleOfferName { get; set; } public KVCalculationWish CalculationWish { get; set; } } public class KVCalculationsForPerson { public KVCalculationsForPerson() { } public int KVCalculationsForPersonId { get; set; } public string KVCalculationsForPersonName { get; set; } public KVCalculationWish CalculationWish { get; set; } } public class EntiyRelation : DbContext { public EntiyRelation() { } public DbSet<KVCalculationWish> CalculationWish { get; set; } public DbSet<KVSingleOffer> SingleOffer { get; set; } public DbSet<KVCalculationsForPerson> CalculationsForPerson { get; set; } protected override void OnModelCreating(System.Data.Entity.ModelConfiguration.ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity<KVCalculationWish>().HasOptional(m => m.SingleOffer).WithRequired(p => p.CalculationWish); modelBuilder.Entity<KVCalculationWish>().HasOptional(m => m.CaculationsForPerson).WithRequired(p => p.CalculationWish); } } i want to use KVCalcuationWish object in KVCalcuationsForPerson and KVSingleOffer class. So when i am creating object of KVCalcuationForPerson and KVSingleOffer class i initialize both object with New KVCalcuationWish object. like this KVCalculationsForPerson calcPerson = new KVCalculationsForPerson(); KVCalculationWish wish = new KVCalculationWish() { CaculationsForPerson = calcPerson }; calcPerson.KVCalculationsForPersonName = "Person Name"; calcPerson.CalculationWish = wish; KVSingleOffer singleOffer = new KVSingleOffer(); KVCalculationWish wish1 = new KVCalculationWish() { SingleOffer = singleOffer }; singleOffer.KVSingleOfferName = "Offer Name"; singleOffer.CalculationWish = wish1; but my problem is when i save this records using following code try { db.CalculationsForPerson.Add(calcPerson); db.SingleOffer.Add(singleOffer); db.SaveChanges(); } catch (Exception ex) { } i can save successfully in DB, but in Table KVCalcuationWish i am not able to get the ID of SingleOffer and CalcuationsForPerson class object. Following is the data of KVCalcuationWish table. KVCalcuationWishID KVCalcuationWishName KVSingleOfferID KVCalcuationsForPersonID 1 NULL 0 0 Following is the data of KVSingleOFfer Table KVSingleOfferID KVSingleOfferName 1 Offer Name Follwing is the data of KVCalcuationsForPerson Table KVSingleOfferID KVSingleOfferName 1 Person Name I want to have following possible output in KVCalcuationWish table. KVCalcuationWishID KVCalcuationWishName KVSingleOfferID KVCalcuationsForPersonID 1 NULL 1 NULL 2 NULL NULL 1 so what i want to achieve is ...... when i am save KVSingleOffer object i want separate record to be inserted and when i save KVCalcuationsForPerson object another separate record should be save to KVCalcuationwish table. Is that possible? Sorry for long description... but i really hang on this situation... Thanks & Regards, Joyous Suhas

    Read the article

  • Installing all the bits to demo Entity Framework 4 on the Visual Studio 2010 Release Candidate

    - by Eric Nelson
    Next week (17th March 2010) I am presenting on EF4 at www.devweek.com in London (and Azure on the 18th). Today I wanted to get all the latest bits on my demo machine and also check if there are any cool new resources I can point people at. Whilst most of the new improvements in Entity Framework come with the Visual Studio 2010 RC (and the RTM), there are a couple of separate items you need to install if you want to explore all the features. To demo EF4 you need: Visual Studio 2010 RC Download and install the Visual Studio 2010 Release Candidate. In my case I went from the Ultimate Edition but it will work fine on Premium and Professional. POCO Templates See the team blog post for a detailed explanation. Use the Extension Manager inside Visual Studio 2010: And install the updated POCO templates for either C# or VB (or both if you are so inclined!): Code First Next you will also need to install Code First (formally called Code Only). This is part of the Entity Framework Feature CTP 3. See the team blog post for a detailed explanation. Download the CTP from Microsoft downloads and run the setup. This will give you a new dll for Code First Optionally (but I recommend it) install LINQPad for the RC Download LINQPad Beta for .NET 4.0 Related Links 101 EF4 Resources

    Read the article

  • Does WPF break an Entity Framework ObjectContext?

    - by David Veeneman
    I am getting started with Entity Framework 4, and I am getting ready to write a WPF demo app to learn EF4 better. My LINQ queries return IQueryable<T>, and I know I can drop those into an ObservableCollection<T> with the following code: IQueryable<Foo> fooList = from f in Foo orderby f.Title select f; var observableFooList = new ObservableCollection<Foo>(fooList); At that point, I can set the appropriate property on my view model to the observable collection, and I will get WPF data binding between the view and the view model property. Here is my question: Do I break the ObjectContext when I move my foo list to the observable collection? Or put another way, assuming I am otherwise handling my ObjectContext properly, will EF4 properly update the model (and the database)? The reason why I ask is this: NHibernate tracks objects at the collection level. If I move an NHibernate IList<T> to an observable collection, it breaks NHibernate's change tracking mechanism. That means I have to do some very complicated object wrapping to get NHibernate to work with WPF. I am looking at EF4 as a way to dispense with all that. So, to get EF4 working with WPF, is it as simple as dropping my IQueryable<T> results into an ObservableCollection<T>. Does that preserve change-tracking on my EDM entity objects? Thanks for your help.

    Read the article

  • WCF data services (OData), query with inheritance limitation?

    - by Mathieu Hétu
    Project: WCF Data service using internally EF4 CTP5 Code-First approach. I configured entities with inheritance (TPH). See previous question on this topic: Previous question about multiple entities- same table The mapping works well, and unit test over EF4 confirms that queries runs smoothly. My entities looks like this: ContactBase (abstract) Customer (inherits from ContactBase), this entity has also several Navigation properties toward other entities Resource (inherits from ContactBase) I have configured a discriminator, so both Customer and Resource map to the same table. Again, everythings works fine on the Ef4 point of view (unit tests all greens!) However, when exposing this DBContext over WCF Data services, I get: - CustomerBases sets exposed (Customers and Resources sets seems hidden, is it by design?) - When I query over Odata on Customers, I get this error: Navigation Properties are not supported on derived entity types. Entity Set 'ContactBases' has a instance of type 'CodeFirstNamespace.Customer', which is an derived entity type and has navigation properties. Please remove all the navigation properties from type 'CodeFirstNamespace.Customer'. Stacktrace: at System.Data.Services.Serializers.SyndicationSerializer.WriteObjectProperties(IExpandedResult expanded, Object customObject, ResourceType resourceType, Uri absoluteUri, String relativeUri, SyndicationItem item, DictionaryContent content, EpmSourcePathSegment currentSourceRoot) at System.Data.Services.Serializers.SyndicationSerializer.WriteEntryElement(IExpandedResult expanded, Object element, ResourceType expectedType, Uri absoluteUri, String relativeUri, SyndicationItem target) at System.Data.Services.Serializers.SyndicationSerializer.<DeferredFeedItems>d__b.MoveNext() at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteItems(XmlWriter writer, IEnumerable`1 items, Uri feedBaseUri) at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteFeedTo(XmlWriter writer, SyndicationFeed feed, Boolean isSourceFeed) at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteFeed(XmlWriter writer) at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteTo(XmlWriter writer) at System.Data.Services.Serializers.SyndicationSerializer.WriteTopLevelElements(IExpandedResult expanded, IEnumerator elements, Boolean hasMoved) at System.Data.Services.Serializers.Serializer.WriteRequest(IEnumerator queryResults, Boolean hasMoved) at System.Data.Services.ResponseBodyWriter.Write(Stream stream) Seems like a limitation of WCF Data services... is it? Not much documentation can be found on the web about WCF Data services (OData) and inheritance specifications. How can I overpass this exception? I need these navigation properties on derived entities, and inheritance seems the only way to provide mapping of 2 entites on the same table with Ef4 CTP5... Any thoughts?

    Read the article

  • Entity Framework 4 omits some associations during model generation

    - by kzen
    After creating an EF4 model from a SQL Server database I noticed that all the relationships of my Users table were not imported into the model as associations. All the other relationships were imported fine. My Users table has a PK userId which is a char(7) field and it is integrated into several other tables in the database as an FK but for some reason EF4 does not import these relationships as associations during the model generation process... Does anyone have any ideas why this would be happening?

    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

  • How to reduce Entity Framework 4 query compile time?

    - by Rup
    Summary: We're having problems with EF4 query compilation times of 12+ seconds. Cached queries will only get us so far; are there any ways we can actually reduce the compilation time? Is there anything we might be doing wrong we can look for? Thanks! We have an EF4 model which is exposed over the WCF services. For each of our entity types we expose a method to fetch and return the whole entity for display / edit including a number of referenced child objects. For one particular entity we have to .Include() 31 tables / sub-tables to return all relevant data. Unfortunately this makes the EF query compilation prohibitively slow: it takes 12-15 seconds to compile and builds a 7,800-line, 300K query. This is the back-end of a web UI which will need to be snappier than that. Is there anything we can do to improve this? We can CompiledQuery.Compile this - that doesn't do any work until first use and so helps the second and subsequent executions but our customer is nervous that the first usage shouldn't be slow either. Similarly if the IIS app pool hosting the web service gets recycled we'll lose the cached plan, although we can increase lifetimes to minimise this. Also I can't see a way to precompile this ahead of time and / or to serialise out the EF compiled query cache (short of reflection tricks). The CompiledQuery object only contains a GUID reference into the cache so it's the cache we really care about. (Writing this out it occurs to me I can kick off something in the background from app_startup to execute all queries to get them compiled - is that safe?) However even if we do solve that problem, we build up our search queries dynamically with LINQ-to-Entities clauses based on which parameters we're searching on: I don't think the SQL generator does a good enough job that we can move all that logic into the SQL layer so I don't think we can pre-compile our search queries. This is less serious because the search data results use fewer tables and so it's only 3-4 seconds compile not 12-15 but the customer thinks that still won't really be acceptable to end-users. So we really need to reduce the query compilation time somehow. Any ideas? Profiling points to ELinqQueryState.GetExecutionPlan as the place to start and I have attempted to step into that but without the real .NET 4 source available I couldn't get very far, and the source generated by Reflector won't let me step into some functions or set breakpoints in them. The project was upgraded from .NET 3.5 so I have tried regenerating the EDMX from scratch in EF4 in case there was something wrong with it but that didn't help. I have tried the EFProf utility advertised here but it doesn't look like it would help with this. My large query crashes its data collector anyway. I have run the generated query through SQL performance tuning and it already has 100% index usage. I can't see anything wrong with the database that would cause the query generator problems. Is there something O(n^2) in the execution plan compiler - is breaking this down into blocks of separate data loads rather than all 32 tables at once likely to help? Setting EF to lazy-load didn't help. I've bought the pre-release O'Reilly Julie Lerman EF4 book but I can't find anything in there to help beyond 'compile your queries'. I don't understand why it's taking 12-15 seconds to generate a single select across 32 tables so I'm optimistic there's some scope for improvement! Thanks for any suggestions! We're running against SQL Server 2008 in case that matters and XP / 7 / server 2008 R2 using RTM VS2010.

    Read the article

  • May 20th Links: ASP.NET MVC, ASP.NET, .NET 4, VS 2010, Silverlight

    - by ScottGu
    Here is the latest in my link-listing series.  Also check out my VS 2010 and .NET 4 series and ASP.NET MVC 2 series for other on-going blog series I’m working on. [In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu] ASP.NET MVC How to Localize an ASP.NET MVC Application: Michael Ceranski has a good blog post that describes how to localize ASP.NET MVC 2 applications. ASP.NET MVC with jTemplates Part 1 and Part 2: Steve Gentile has a nice two-part set of blog posts that demonstrate how to use the jTemplate and DataTable jQuery libraries to implement client-side data binding with ASP.NET MVC. CascadingDropDown jQuery Plugin for ASP.NET MVC: Raj Kaimal has a nice blog post that demonstrates how to implement a dynamically constructed cascading dropdownlist on the client using jQuery and ASP.NET MVC. How to Configure VS 2010 Code Coverage for ASP.NET MVC Unit Tests: Visual Studio enables you to calculate the “code coverage” of your unit tests.  This measures the percentage of code within your application that is exercised by your tests – and can give you a sense of how much test coverage you have.  Gunnar Peipman demonstrates how to configure this for ASP.NET MVC projects. Shrinkr URL Shortening Service Sample: A nice open source application and code sample built by Kazi Manzur that demonstrates how to implement a URL Shortening Services (like bit.ly) using ASP.NET MVC 2 and EF4.  More details here. Creating RSS Feeds in ASP.NET MVC: Damien Guard has a nice post that describes a cool new “FeedResult” class he created that makes it easy to publish and expose RSS feeds from within ASP.NET MVC sites. NoSQL with MongoDB, NoRM and ASP.NET MVC Part 1 and Part 2: Nice two-part blog series by Shiju Varghese on how to use MongoDB (a document database) with ASP.NET MVC.  If you are interested in document databases also make sure to check out the Raven DB project from Ayende. Using the FCKEditor with ASP.NET MVC: Quick blog post that describes how to use FCKEditor – an open source HTML Text Editor – with ASP.NET MVC. ASP.NET Replace Html.Encode Calls with the New HTML Encoding Syntax: Phil Haack has a good blog post that describes a useful way to quickly update your ASP.NET pages and ASP.NET MVC views to use the new <%: %> encoding syntax in ASP.NET 4.  I blogged about the new <%: %> syntax – it provides an easy and concise way to HTML encode content. Integrating Twitter into an ASP.NET Website using OAuth: Scott Mitchell has a nice article that describes how to take advantage of Twiter within an ASP.NET Website using the OAuth protocol – which is a simple, secure protocol for granting API access. Creating an ASP.NET report using VS 2010 Part 1, Part 2, and Part 3: Raj Kaimal has a nice three part set of blog posts that detail how to use SQL Server Reporting Services, ASP.NET 4 and VS 2010 to create a dynamic reporting solution. Three Hidden Extensibility Gems in ASP.NET 4: Phil Haack blogs about three obscure but useful extensibility points enabled with ASP.NET 4. .NET 4 Entity Framework 4 Video Series: Julie Lerman has a nice, free, 7-part video series on MSDN that walks through how to use the new EF4 capabilities with VS 2010 and .NET 4.  I’ll be covering EF4 in a blog series that I’m going to start shortly as well. Getting Lazy with System.Lazy: System.Lazy and System.Lazy<T> are new features in .NET 4 that provide a way to create objects that may need to perform time consuming operations and defer the execution of the operation until it is needed.  Derik Whittaker has a nice write-up that describes how to use it. LINQ to Twitter: Nifty open source library on Codeplex that enables you to use LINQ syntax to query Twitter. Visual Studio 2010 Using Intellitrace in VS 2010: Chris Koenig has a nice 10 minute video that demonstrates how to use the new Intellitrace features of VS 2010 to enable DVR playback of your debug sessions. Make the VS 2010 IDE Colors look like VS 2008: Scott Hanselman has a nice blog post that covers the Visual Studio Color Theme Editor extension – which allows you to customize the VS 2010 IDE however you want. How to understand your code using Dependency Graphs, Sequence Diagrams, and the Architecture Explorer: Jennifer Marsman has a nice blog post describes how to take advantage of some of the new architecture features within VS 2010 to quickly analyze applications and legacy code-bases. How to maintain control of your code using Layer Diagrams: Another great blog post by Jennifer Marsman that demonstrates how to setup a “layer diagram” within VS 2010 to enforce clean layering within your applications.  This enables you to enforce a compiler error if someone inadvertently violates a layer design rule. Collapse Selection in Solution Explorer Extension: Useful VS 2010 extension that enables you to quickly collapse “child nodes” within the Visual Studio Solution Explorer.  If you have deeply nested project structures this extension is useful. Silverlight and Windows Phone 7 Building a Simple Windows Phone 7 Application: A nice tutorial blog post that demonstrates how to take advantage of Expression Blend to create an animated Windows Phone 7 application. If you haven’t checked out my Windows Phone 7 Twitter Tutorial I also recommend reading that. Hope this helps, Scott P.S. If you haven’t already, check out this month’s "Find a Hoster” page on the www.asp.net website to learn about great (and very inexpensive) ASP.NET hosting offers.

    Read the article

  • CodePlex Daily Summary for Tuesday, March 15, 2011

    CodePlex Daily Summary for Tuesday, March 15, 2011Popular ReleasesPhalanger - The PHP Language Compiler for the .NET Framework: 2.0 (March 2011): Phalanger 2.0 (March 2011) Release with Visual Studio 2008 integration. You can install additional managed MySQL extension to improve the performance of your application.Kooboo CMS: Kooboo 3.0 RC: Bug fixes Inline editing toolbar positioning for websites with complicate CSS. Inline editing is turned on by default now for the samplesite template. MongoDB version content query for multiple filters. . Add a new 404 page to guide users to login and create first website. Naming validation for page name and datarule name. Files in this download kooboo_CMS.zip: The Kooboo application files Content_DBProvider.zip: Additional content database implementation of MSSQL,SQLCE, RavenDB ...SQL Monitor - tracking sql server activities: SQL Monitor 3.2: 1. introduce sql color syntax highlighting with http://www.codeproject.com/KB/edit/FastColoredTextBox_.aspxUmbraco CMS: Umbraco 4.7.0: Service release fixing 50+ issues! Getting Started A great place to start is with our Getting Started Guide: Getting Started Guide: http://umbraco.codeplex.com/Project/Download/FileDownload.aspx?DownloadId=197051 Make sure to check the free foundation videos on how to get started building Umbraco sites. They're available from: Introduction for webmasters: http://umbraco.tv/help-and-support/video-tutorials/getting-started Understand the Umbraco concepts: http://umbraco.tv/help-and-support...Facebook C# SDK: 5.0.5 (BETA): This is sixth BETA release of the version 5 branch of the Facebook C# SDK. Remember this is a BETA build. Some things may change or not work exactly as planned. We are absolutely looking for feedback on this release to help us improve the final 5.X.X release. New in this release: Version 5.0.5 is almost completely backward compatible with 4.2.1 and 5.0.3 (BETA) Bug fixes and helpers to simplify many common scenarios Fixed a last minute issue in version 5.0.4 in Facebook.Web For more inf...ProDinner - ASP.NET MVC EF4 Code First DDD jQuery Sample App: first release: ProDinner is an ASP.NET MVC sample application, it uses DDD, EF4 Code First for Data Access, jQuery and MvcProjectAwesome for Web UI, it has Multi-language User Interface Features: CRUD and search operations for entities Multi-Language User Interface upload and crop Images (make thumbnail) for meals pagination using "more results" button very rich and responsive UI (using Mvc Project Awesome) Multiple UI themes (using jQuery UI themes)BEPUphysics: BEPUphysics v0.15.0: BEPUphysics v0.15.0!LiveChat Starter Kit: LCSK v1.1: This release contains couple of new features and bug fixes including: Features: Send chat transcript via email Operator can now invite visitor to chat (pro-active chat request) Bug Fixes: Operator management (Save and Delete) bug fixes Operator Console chat small fixesIronRuby: 1.1.3: IronRuby 1.1.3 is a servicing release that keeps on improving compatibility with Ruby 1.9.2 and includes IronRuby integration to Visual Studio 2010. We decided to drop 1.8.6 compatibility mode in all post-1.0 releases. We recommend using IronRuby 1.0 if you need 1.8.6 compatibility. The main purpose of this release is to sync with IronPython 2.7 release, i.e. to keep the Dynamic Language Runtime that both these languages build on top shareable. This release also fixes a few bugs: 5763 Use...SQL Server PowerShell Extensions: 2.3.2.1 Production: Release 2.3.2.1 implements SQLPSX as PowersShell version 2.0 modules. SQLPSX consists of 13 modules with 163 advanced functions, 2 cmdlets and 7 scripts for working with ADO.NET, SMO, Agent, RMO, SSIS, SQL script files, PBM, Performance Counters, SQLProfiler, Oracle and MySQL and using Powershell ISE as a SQL and Oracle query tool. In addition optional backend databases and SQL Server Reporting Services 2008 reports are provided with SQLServer and PBM modules. See readme file for details.IronPython: 2.7: On behalf of the IronPython team, I'm very pleased to announce the release of IronPython 2.7. This release contains all of the language features of Python 2.7, as well as several previously missing modules and numerous bug fixes. IronPython 2.7 also includes built-in Visual Studio support through IronPython Tools for Visual Studio. IronPython 2.7 requires .NET 4.0 or Silverlight 4. To download IronPython 2.7, visit http://ironpython.codeplex.com/releases/view/54498. Any bugs should be report...XML Explorer: XML Explorer 4.0.2: Changes in 4.0: This release is built on the Microsoft .NET Framework 4 Client Profile. Changed XSD validation to use the schema specified by the XML documents. Added a VS style Error List, double-clicking an error takes you to the offending node. XPathNavigator schema validation finally gives SourceObject (was fixed in .NET 4). Added Namespaces window and better support for XPath expressions in documents with a default namespace. Added ExpandAll and CollapseAll toolbar buttons (in a...Mobile Device Detection and Redirection: 1.0.0.0: Stable Release 51 Degrees.mobi Foundation has been in beta for some time now and has been used on thousands of websites worldwide. We’re now highly confident in the product and have designated this release as stable. We recommend all users update to this version. New Capabilities MappingsTo improve compatibility with other libraries some new .NET capabilities are now populated with wurfl data: “maximumRenderedPageSize” populated with “max_deck_size” “rendersBreaksAfterWmlAnchor” populated ...ASP.NET MVC Project Awesome, jQuery Ajax helpers (controls): 1.7.3: A rich set of helpers (controls) that you can use to build highly responsive and interactive Ajax-enabled Web applications. These helpers include Autocomplete, AjaxDropdown, Lookup, Confirm Dialog, Popup Form, Popup and Pager added interactive search for the lookupWPF Inspector: WPF Inspector 0.9.7: New Features in Version 0.9.7 - Support for .NET 3.5 and 4.0 - Multi-inspection of the same process - Property-Filtering for multiple keywords e.g. "Height Width" - Smart Element Selection - Select Controls by clicking CTRL, - Select Template-Parts by clicking CTRL+SHIFT - Possibility to hide the element adorner (over the context menu on the visual tree) - Many bugfixes??????????: All-In-One Code Framework ??? 2011-03-10: http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=1codechs&DownloadId=216140 ??,????。??????????All-In-One Code Framework ???,??20?Sample!!????,?????。http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=1code&DownloadId=128165 ASP.NET ??: CSASPNETBingMaps VBASPNETRemoteUploadAndDownload CS/VBASPNETSerializeJsonString CSASPNETIPtoLocation CSASPNETExcelLikeGridView ....... Winform??: FTPDownload FTPUpload MultiThreadedWebDownloader...Rawr: Rawr 4.1.0: Rawr is now web-based. The link to use Rawr4 is: http://elitistjerks.com/rawr.phpThis is the Cataclysm Release. More details can be found at the following link http://rawr.codeplex.com/Thread/View.aspx?ThreadId=237262 As of the 4.0.16 release, you can now also begin using the new Downloadable WPF version of Rawr!This is a Release of the WPF version, most of the general issues have been resolved. If you have a problem, please follow the Posting Guidelines and put it into the Issue Tracker. Whe...PHP Manager for IIS: PHP Manager 1.1.2 for IIS 7: This is a localization release of PHP Manager for IIS 7. It contains all the functionality available in 56962 plus a few bug fixes (see change list for more details). Most importantly this release is translated into five languages: German - the translation is provided by Christian Graefe Dutch - the translation is provided by Harrie Verveer Turkish - the translation is provided by Yusuf Oztürk Japanese - the translation is provided by Kenichi Wakasa Russian - the translation is provid...myCollections: Version 1.3: New in version 1.3 : Added Editor management for Books Added Amazon API for Books Us, Fr, De Added Amazon Us, Fr, De for Movies Added The MovieDB for Fr and De Added Author for Books Added Editor and Platform for Games Added Amazon Us, De for Games Added Studio for XXX Added Background for XXX Bug fixing with Softonic API Bug fixing with IMDB UI improvement Removed GraceNote Added Amazon Us,Fr, De for Series Added TVDB Fr and De for Series Added Tracks for Musi...patterns & practices : Composite Services: Composite Services Guidance - CTP2: Overview The Composite Services guidance (codename Reykjavik) provides best practices and capabilities for applying industry-known SOA design patterns when building robust, connected, service-oriented composite enterprise applications. These capabilities are implemented as a set of reusable components for analytic tracing, service virtualization, metadata centralization and versioning, and policy centralization as well as exception management, included in this release. Changes in this CTP ...New ProjectsAlice:????????????demo: ???????????????,????????????,????????????????????demo。??cnblogs????????:http://www.cnblogs.com/xuqiang/android-maps: maps trackbeginner: beginnerBing Maps Android SDK: The Bing Maps Android SDK is a base project that can be used to help developers create mapping applications using Microsoft's Bing Maps. This is written in Java and built using the Bing Maps AJAX v7 control.Brokenhouse WPF Control Suite: The Brokenhouse Control Suite is library that provides a rich set of controls for the Windows Presentation Foundation (WPF). It provides a full featured transition control as well as WPF replacements for the standard windows Wizards and Task dialogs. Call Centre Management: This is project Q5Captcha Control: Captcha Control (C#) allows users to add a captcha to an asp.net page. The control supports declarative settings of fontsize, font family, color, captcha length, background image, character set, success, error and buttons' text. Supports audio - reading out the captcha text.CMC7 Validator: Componente para validação de códigos CMC7CRM 2011 Jscript Soap Request Formatter: Works in conjunction to soaplogger solution included in CRM 2011 SDK to format captured envelopes in Jscript, ready for use in the CRM GUI. Eventually I would like to combine the Soap Logger functionality entirely.Cross Platform Wireless Communication: This is a cross platform bluetooth communications project.CxCarbon: Business Applicationecommerce project: E-Commerces ProjectFamsWCF: final projectFitCalc: Fitnes calculator. Some math about fitnessFuturisticsPro: project Case Study 3 : Call Centre managementGame Sprite Generator: Allows to control sprite transformation in a GUI and export code to XNA.HeartLand Home FinanceQT5: Hello!HospitalManager: project q5InfoPathFilesGrabber: This tool will help you to extract InfoPath files which can be saved to local disk or to a SharePoint list item. Take a look at the project InfoPathFileDecoder in this solution. Soon I am going to clean up the code and provide some test files.iOS Movie list viewer: Movies application has several use cases which covers different functionalities, like listing popular movies or searching by keyword. The information about movies should be retrieved from http://www.themoviedb.org/ which has publically exposed API http://api.themoviedb.org/2.1/. Model XML Importer And Exporter: Contains a XML specification of a 3D model that handles animation, cameras, light, bones, and models. Also contains a Importer for C++ and C# and the C++ 3DS exporterNIIT Sample Music Store: This project is very useful.Orchard Module - Bing Map Lists: An Orchard CMS module to display more than one place on a Bing Map. This module would be great for creating a guide to an area displaying all the different points of interest.Ovvio: OvvioPigmalión: Todo lo desees puede hacerce realidad.... solo programalo.. :PPrism MVVMP Stub and Sample: This project contains a sample application demonstrating the Model View ViewModel Presenter (MVVMP) Pattern. It also contains a stub that can be used to rapidly build an MVVMP based application using Prism.ProDinner - ASP.NET MVC EF4 Code First DDD jQuery Sample App: ProDinner is an ASP.NET MVC sample application, it uses DDD, EF4 Code First for Data Access, jQuery and MvcProjectAwesome for Web UI, it has Multi-language User InterfaceProjectQ5_V2: ProjectQ5Public Key Infrastructure PowerShell module: This module is intended to simplify certain PKI management tasks by using automation with Windows PowerShell.Qmiks Digital Media Module for Orchard CSM: Qmiks - Digital Media is a Orchad CMS module which allows a user to include digital content: audio, video, images into Orchard based web site. QuickSearch Pro: This Is ProQ4-M2. Case Study 1: QuickSearchSALT: Sistema Criado para acompanhamento de licitaçõesshahnawazwsccemb: web scripting and content creationShuttle Wiki: Shuttle Wiki uses Asp.NET MVC Razor along with JQuery and Sql ServerSoftware Render: Full Software Render developed in C# and XNA using the Ploobs Engine ( http://ploobsengine.codeplex.com ). Mimic the stages of Directx 11 pipeline in software, including Vertex, Geometric,Pixel, Hull and Domain Shader programable in C#. Uses Barycentric triangle rasterization.Starter CRM Solution for SharePoint 2010: To design and build a SPF2010 template to provision basic CRM functionality for the small business owner. Core CRM Entities will be based on OOB Custom Lists (with Forms customized with SP Designer) while more elaborate features will be built using C# & VS2010. Stock# Connectors: ?????????? ? ????????? ???????? ?????????? ??? S#( http://stocksharp.com/ ). ?? ?????? ?????? ??????????????? ????????? ??? Transaq.tdryan Code Samples & Repository: This resource page serves as my file repository for code samples that I share with others.UCB_GP_A: this is a pilot project which is intented to help the college education. .VB DB - Visual Basic Database: A brand new totally Visual Basic append only object database engine. Way2Sms Applications for Android, Desktop/Laptop & Java enabled phones: Apps that allow sending free sms all over India using Way2Sms. No irritating ads are shown. Message sending is really fast and simple compared to the website. Following clients are supported - 1. Android 2. Desktop/Laptop - Mac/Windows/Linux 3. Java enabled phoneXmlAsRelationalTvf: TSQL CLR table-valued-function to read XML as relational data. Including a sample that reads wikipedia-dumps and return as relational record set.

    Read the article

  • Entity Framework 4 ste delete foreign key relationship

    - by user169867
    I'm using EF4 and STE w/ Silverlight. I'm having trouble deleting child records from my primary entity. For some reason I can remove child entities if their foreign key to my primary entity is part of their Primary Key. But if it's not, they don't get removed. I believe these posts explains it: http://mocella.blogspot.com/2010/01/entity-framework-v4-object-graph.html http://blogs.msdn.com/dsimmons/archive/2010/01/31/deleting-foreign-key-relationships-in-ef4.aspx My question is how how do I remove a child record who's foreign key is not part of its primary key in Silverlight where I don't have access to a DeleteObject() function?

    Read the article

  • Asp.net ADO.NET Entity Framework or ADO.NET

    - by sharru
    I'm starting a new project based on ASP.NET and Windows server. The application is planned to be pretty big and serve large amount of clients pulling and updating high freq. changing data. I have previously created projects with Linq-To-Sql or with Ado.Net. My plan for this project is to use VS2010 and the new EF4 framework. It would be great to hear other programmers options about development with Entity Framework Pros and cons from previous experience? Do you think EF4 is ready for production? Should i take the risk or just stick with plain old good ADO.NET?

    Read the article

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

    - by Perpetualcoder
    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 first development I do db first development Edit: Moved question related to object context to another question here.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >