Search Results

Search found 9916 results on 397 pages for 'entity component'.

Page 89/397 | < Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >

  • error 2016: Condition cannot be specified for Column member

    - by IP
    I am having some issues with Entity Framework in VS2010 The problem I'm getting is described very well here... http://social.msdn.microsoft.com/Forums/en/adonetefx/thread/cacf6a76-09a8-4c90-9502-d8b87c2f6bea It's basically happening when a Foreign key is pointed at the primary key of another table...but if I take off the StoreGeneratedPattern as "Identity", then it tries to insert a value into the identity field ** EDIT So, what it seems to be is that EF4 can't handle a null relationship when the primary key is set to StoreGeneratedPattern="Identity". If I create a FK pointing to this primary key, and make it nullable (effectively creating a 0...M relationship), then it throws this compilation error. Removing StoreGeneratedPattern="Identity" fixes the issue, but causes issues elseware It works if the foreign key is set to not nullable

    Read the article

  • How to implement multi relationship in MS SQL?

    - by Ethan
    I’m trying to design a database to use with ASP.net MVC application. Here is the scenario: There are three entities and users can post their comments for each of these different entities. I just wonder how just put one table for Comments and link all other entities to it. Obviously, Comments table needs 3 references (foreign key) to those tables but as you know these foreign keys can’t be null and just one of them can be filled for each row. Is there any better way than implementing three different tables for each entity’s comments? Cheers Ethan

    Read the article

  • ForEach with EditorFor

    - by hermiod
    I have got an Entity model which contains a collection of Message objects which are of the type Message which has several properties, including content, MessageID, from, and to. I have created an EditorTemplate for type Message, however, I cannot get it to display the contents of the Messages collection. There are no errors, but nothing is output. Please note that the view code is from an EditorTemplate for the parent Talkback class. Can you have an EditorTemplate calling another EditorTemplate for a child collection? Both the Talkback and Message class are generated by Entity framework from an existing database. View code: <% foreach (TalkbackEntityTest.Message msg in Model.Messages) { Html.EditorFor(x=> msg, "Message"); } %> This is my template code. It is the standard auto-generated view code with some minor changes. <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TalkbackEntityTest.Message>" %> <%: Html.ValidationSummary(true) %> <fieldset> <legend>Fields</legend> <div class="editor-label"> <%: Html.LabelFor(model => model.MessageID) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.MessageID) %> <%: Html.ValidationMessageFor(model => model.MessageID) %> </div> <div class="editor-label"> <%: Html.LabelFor(model => model.acad_period) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.acad_period) %> <%: Html.ValidationMessageFor(model => model.acad_period) %> </div> <div class="editor-label"> <%: Html.LabelFor(model => model.talkback_id) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.talkback_id) %> <%: Html.ValidationMessageFor(model => model.talkback_id) %> </div> <div class="editor-label"> <%: Html.LabelFor(model => model.From) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.From) %> <%: Html.ValidationMessageFor(model => model.From) %> </div> <div class="editor-label"> <%: Html.LabelFor(model => model.To) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.To) %> <%: Html.ValidationMessageFor(model => model.To) %> </div> <div class="editor-label"> <%: Html.LabelFor(model => model.SentDatetime) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.SentDatetime, String.Format("{0:g}", Model.SentDatetime)) %> <%: Html.ValidationMessageFor(model => model.SentDatetime) %> </div> <div class="editor-label"> <%: Html.LabelFor(model => model.content) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.content) %> <%: Html.ValidationMessageFor(model => model.content) %> </div> <div class="editor-label"> <%: Html.LabelFor(model => model.MessageTypeID) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.MessageTypeID) %> <%: Html.ValidationMessageFor(model => model.MessageTypeID) %> </div> <p> <input type="submit" value="Save" /> </p> </fieldset> There is definitely content in the Message collection as, if I remove EditorFor and put in response.write on the content property of the Message class, I get the content field for 3 Message objects on the page, which is exactly as expected.

    Read the article

  • Potential for SQL injection here?

    - by Matt Greer
    This may be a really dumb question but I figure why not... I am using RIA Services with Entity Framework as the back end. I have some places in my app where I accept user input and directly ask RIA Services (and in turn EF and in turn my database) questions using their data. Do any of these layers help prevent security issues or should I scrub my data myself? For example, whenever a new user registers with the app, I call this method: [Query] public IEnumerable<EmailVerificationResult> VerifyUserWithEmailToken(string token) { using (UserService userService = new UserService()) { // token came straight from the user, am I in trouble here passing it directly into // my DomainService, should I verify the data here (or in UserService)? User user = userService.GetUserByEmailVerificationToken(token); ... } } (and whether I should be rolling my own user verification system is another issue altogether, we are in the process of adopting MS's membership framework. I'm more interested in sql injection and RIA services in general)

    Read the article

  • What's all the hype over objectsets?

    - by Kohan
    I am an intermediate user of EF in .net 3.5 and have recently moved to working with .net 4. One think i keep coming across when reading various tutorials is the use of ObjectSets instead of ObjectQuerys and that they are a great new feature. What is so great about them? Reading this MSDN article titled "Working with ObjectSet (Entity Framework)" It shows two examples for on how to add a Product.. one for 3.5 and another for 4.0. http://msdn.microsoft.com/en-us/library/ee473442.aspx Though my lack of knowledge I am possibly bringing up a seperate point here, but i never added a Product like this: //In .NET Framework 3.5 SP1, use the following code: using (AdventureWorksEntities context = new AdventureWorksEntities()) { // Add the new object to the context. context.AddObject("Products", newProduct); } I would have just used context.AddToProducts(newProduct); Please enlighten me. Kind regards, Kohan

    Read the article

  • What 'best practices' exist for handing enum heirarchies?

    - by FerretallicA
    I'm curious as to any solutions out there for addressing enum heirarchies. I'm working through some docs on Entity Framework 4 and trying to apply it to a simple inventory tracking program. The possible types for inventory to fall into are as follows: INVENTORY ITEM TYPES: Hardware PC Desktop Server Laptop Accessory Input (keyboards, scanners etc) Output (monitors, printers etc) Storage (USB sticks, tape drives etc) Communication (network cards, routers etc) Software What recommendations are there for handling enums in a situation like this? Are enums even the solution? I don't really want to have a ridiculously normalised database for such a relatively simple experiment (eg tables for InventoryType, InventorySubtype, InventoryTypeToSubtype etc). I don't really want to over-complicate my data model with each subtype being inherited even though no additional properties or methods are included (except PC types which would ideally have associated accessories and software but that's probably out of scope here). It feels like there should be a really simple, elegant solution to this but I can't put my finger on it. Any assistance or input appreciated!

    Read the article

  • Closing an EDM ObjectContext?

    - by David Veeneman
    I am getting started with the ADO.NET Entity Framework 4.0. I have created an EDM and data store for the app, and it successfully retrieves entities. The application holds the EDM's ObjectContext as a member-level variable, which it uses to call ObjectContext.SaveChanges(). So far, so good. I am going to refactor to repositories later. Right now, my question is a bit more basic: When I am finished with the EDM, what do I need to do to release it? Is it as simple as calling Dispose() on the ObjectContext? Thanks for your help.

    Read the article

  • Where to execute extra logic for linq to entities query?

    - by Inez
    Let say that I want to populate a list of CustomerViewModel which are built based on Customer Entity Framework model with some fields (like Balance) calculated separately. Below I have code which works for lists - it is implemented in my service layer, but also I want to execute this code when I just get one item from the database and execute is as well in different services where I'm accessing Customers data as well. How should I do this to ensure performance but to to not duplicate code - the one for calculating Balance? public List<CustomerViewModel> GetCustomerViewModelList() { IQueryable<CustomerViewModel> list = from k in _customerRepository.List() select new CustomerViewModel { Id = k.Id, Name = k.Name, Balance = k.Event.Where(z => z.EventType == (int) EventTypes.Income).Sum(z => z.Amount) }; return list.ToList(); }

    Read the article

  • Cocoa Core Data - Efficient Related Entities Counts

    - by Gary
    I am working on my first iPhone application and I've hit a wall. I'm trying to develop a 'statistics' page for a three entity relationship. My entities are the following: Department - Name, Address, Building, etc. People - Name, Gender (BOOL), Phone, etc If I have fetched a specific department how do I filter those results and only return people that are Male (Gender == 0)? If I do NSLog(@"%d", [department.people count]); I get the correct number of people in that department so I know I'm in the neighborhood. I know I could re-fetch and modify the predicate each time but with 20+ stats in my app that seems inefficient. Thanks for any advice!

    Read the article

  • Sorting the data returned by a database

    - by Rishabh Ohri
    hi all, In our project we have a requirement that when a set of records are returned by the database the records should be sorted with respect to the TITLE field in the record. The records will have to be sorted alphabetically but if the title of a record has a number in it then it should come after the records whose title only consists of alphabets. Details: we are using SQL Server , and c#. The data from the database comes to an Entity class whic forwards the data to other layers. So, What will be the possible and effective solution for this requirement.

    Read the article

  • C# LINQ Where Predicate Type Arguments

    - by blu
    I have an XElement with values for mock data. I have an expression to query the xml: Expression<Func<XElement, bool>> simpleXmlFunction = b => int.Parse(b.Element("FooId").Value) == 12; used in: var simpleXml = xml.Elements("Foo").Where(simpleXmlFunction).First(); The design time error is: The type arguments for method 'System.Linq.Enumerable.Where(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly' The delegate supplied to Where should take in an XElement and return a bool, marking if the item matches the query, I am not sure how to add anything more to the delegate or the where clause to mark the type. Also, the parallel method for the real function against the Entity Framework does not have this issue. What is not correct with the LINQ-to-XML version?

    Read the article

  • Core Data Relationships in pre-populated SQLite database

    - by Cardinal
    Hi All, I'm new to Core Data. Currently I have following tables on hand: tbl_teahcer tbl_student tbl_course tbl_student_course_map ----------- ----------- ---------- ---------------------- teacher_id student_id course_id student_id name name name course_id teahcer_id And I'm going to make the xcdatamodel as below: Course Teacher ------ ------- name name teacher <<----------> courses students <<---| | Student | ------- | name |----->> courses My questions are as follows: As I'd like to create TableView for Cource Entity, is it a must to create the Inverse Relationship from Teacher to Course, and Student to Course? What is the beneit for having the Inverse Relationship? I got some pre-defined data on hand, and I'd like to create a SQLite storage for pre-populated source. How can I set up the relationships (both directions) in SQLite? Thank you for your help! Regards, Cardinal

    Read the article

  • Entities Framework 4 doing a bulk delete

    - by Adan
    I wish to know if there is a good way to do a bulk delete or delete multiple rows using the Entities Framework 4. I can't seam to find a DeleteAll command. The only one that is available is DeleteObject() which only takes one entity, I would like to perform a delete on a list of entities.Is there a better way than to loop trough the list? I did see an article that used ExecuteStoreQuery and created some sql that would perform the delete. Is there a better way than to perform any of these two options Please advice what is the best way to perform this action.

    Read the article

  • Deleting objects through foreign key relationship with T-SQL query

    - by LaserBeak
    Looking for a way to write the following LinQ to entities query as a T-SQL statement. repository.ProductShells.Where(x => x.ShellMembers.Any(sm => sm.ProductID == pid)).ToList().ForEach(x => repository.ProductShells.Remove(x)); The below is obviously not correct but I need it to delete respective ProductShell object where any ShellMember contains a ProductID equal to the passed in variable pid. I would presume this would involve a join statement to get the relevant ShellMembers. repository.Database.ExecuteSqlCommand("FROM Shellmembers WHERE ProductID={0} DELETE FK_ProductShell", pid); I have cascade delete enabled for the FK_ShellMembers_ProductShells foreign key, so when I delete the ProductShell it will delete all the ShellMembers that are associated with it. I am going to pass this statement to System.Data.Entity Database.ExecuteSqlCommand method.

    Read the article

  • How to serve a View as CSV in ASP.NET Web Forms

    - by ChessWhiz
    Hi, I have a MS SQL view that I want to make available as a CSV download in my ASPNET Web Forms app. I am using Entity Framework for other views and tables in the project. What's the best way to enable this download? I could add a HyperLink whose click handler iterates over the view, writes its CSV form to the disk, and then serves that file. However, I'd prefer not to write to the disk if it can be avoided, and that involves iteration code that may be avoided with some other solution. Any ideas?

    Read the article

  • dynamically create sitemap xml using php

    - by rekhasathvika
    Hi, I have created sitemap for my site using some reference code in the below link http://stackoverflow.com/questions/2747801/creating-an-xml-sitemap-with-php But I am getting error as XML Parsing Error: undefined entity Location: as my content is as follows << alt attribute and it says something like < loc http://www.example.com/700- & laquo;alt & raquo;-attributes-in-images.php< /loc Can anyone tell me how to get rid of this error.

    Read the article

  • EF4 - What's all the hype over objectsets?

    - by Kohan
    I am an intermediate user of EF in .net 3.5 and have recently moved to working with .net 4. One think i keep coming across when reading various tutorials is the use of ObjectSets instead of ObjectQuerys and that they are a great new feature. What is so great about them? Reading this MSDN article titled "Working with ObjectSet (Entity Framework)" It shows two examples for on how to add a Product.. one for 3.5 and another for 4.0. http://msdn.microsoft.com/en-us/library/ee473442.aspx Though my lack of knowledge I am possibly bringing up a seperate point here, but i never added a Product like this: //In .NET Framework 3.5 SP1, use the following code: using (AdventureWorksEntities context = new AdventureWorksEntities()) { // Add the new object to the context. context.AddObject("Products", newProduct); } I would have just used context.AddToProducts(newProduct); Please enlighten me. Kind regards, Kohan

    Read the article

  • Differences between query using LINQ and IQueryable interface directly?

    - by JohnMetta
    Using Entity Framework 4, and given: ObjectSet<Thing> AllThings = Context.CreateObjectSet<Thing>; public IQueryable<Thing> ByNameA(String name) { IQueryable<Thing> query = from o in AllThings where o.Name == name select o; return query; } public IQueryable<Thing> ByNameB(String name) { return AllThings.Where((o) => o.Name == name); } Both return IQueryable< instances, and thus the query doesn't hit the server until something like ToList() is called, right? Is it purely readability that is the difference, or are the using fundamentally different technologies on the back-end?

    Read the article

  • First try StructureMap and MVC3 via NuGet

    - by Angel Escobedo
    Hello Guys, I'm trying to figure how to config StructureMap for ASP.NET MVC3 I've already using NuGet and I notice that it creates App_Start Folder with a cs file named as StructuremapMVC, so I check it and notice that is the same code but simplified that will be written manually on App_Start section placed on Global.asax... My Question is when I inject some IoC on my Controllers as the follow (I use this pattern : Entity Framework 4 CTP 4 / CTP 5 Generic Repository Pattern and Unit Testable) : private readonly IAsambleaRepository _aRep; private readonly IUnitOfWork _uOw; public AsambleaController(IAsambleaRepository aRep, IUnitOfWork uOw) { _aRep = aRep; this._uOw = uOw; } public ActionResult List(string period) { var rs = _aRep.ByPeriodo(period).ToList<Asamblea>(); return View(); } I got an Exception Exception Details: System.MissingMethodException: No parameterless constructor defined for this object.

    Read the article

  • Microsoft SQL Server 2008 - 99% fragmentation on non-clustered, non-unique index

    - by user550441
    I have a table with several indexes (defined below). One of the indexes (IX_external_guid_3) has 99% fragmentation regardless of rebuilding/reorganizing the index. Anyone have any idea as to what might cause this, or the best way to fix it? We are using Entity Framework 4.0 to query this, the EF queries on the other indexed fields about 10x faster on average then the external_guid_3 field, however an ADO.Net query is roughly the same speed on both (though 2x slower than the EF Query to indexed fields). Table id(PK, int, not null) guid(uniqueidentifier, null, rowguid) external_guid_1(uniqueidentifier, not null) external_guid_2(uniqueidentifier, null) state(varchar(32), null) value(varchar(max), null) infoset(XML(.), null) -- usually 2-4K created_time(datetime, null) updated_time(datetime, null) external_guid_3(uniqueidentifier, not null) FK_id(FK, int, null) locking_guid(uniqueidentifer, null) locked_time(datetime, null) external_guid_4(uniqueidentifier, null) corrected_time(datetime, null) is_add(bit, not null) score(int, null) row_version(timestamp, null) Indexes PK_table(Clustered) IX_created_time(Non-Unique, Non-Clustered) IX_external_guid_1(Non-Unique, Non-Clustered) IX_guid(Non-Unique, Non-Clustered) IX_external_guid_3(Non-Unique, Non-Clustered) IX_state(Non-Unique, Non-Clustered)

    Read the article

  • EntityFramework & RowNumber

    - by Dan
    Hello. How can I query RowNumber with Entity Framework? For example: var result = data.Users .OrderByDescending("Birthday") .ThenBy("LastName") .ThenBy("FirstName") .Select(u => { RowNumber = ???, u.FirstName, u.LastName }); I want to implement paging for my grid, but I cannot solve problem with finding page with needed user. I'm using EF4.0. Select method with index(http://msdn.microsoft.com/en-us/vcsharp/aa336758.aspx#SelectIndexed) not works with EF. May be there is another way to implement this?

    Read the article

  • How to implement multi relationship in SQL Server?

    - by Ethan
    I’m trying to design a database to use with ASP.net MVC application. Here is the scenario: There are three entities and users can post their comments for each of these different entities. I just wonder how just put one table for Comments and link all other entities to it. Obviously, Comments table needs 3 references (foreign key) to those tables but as you know these foreign keys can’t be null and just one of them can be filled for each row. Is there any better way than implementing three different tables for each entity’s comments?

    Read the article

  • Architecture Guidance for designing Workflow Foundation with WCF

    - by Matrix
    We are planning to use WF 3.5 with WCF 3.5 and Entity Framework 1.0 for the upcoming major project. I'm looking for guidance on the architecture side. This new application will be based on typical 3-tier architecture as depicted below: Presentation Tier: ASP.NET Web Forms 3.5 Business Tier: WF 3.5 + BLL's that expose the business logic through WCF service interfaces (using EF for Data Access) Data Tier: SQL Server 2000 Here are the questions: Though the Workflow Foundation has Workflow Services, where we can map the WCF service contracts to a workflow, is this the right way to design the applications? Is EF 1.0 business entities can be used in n-tier apps without sacrificing the tracking changes in the entities? Is there a sample reference application available to look? Thanks.

    Read the article

  • Manipulating individual rows of a datagrid

    - by pfranchise
    Hey, recently I started working on a webpage that has a datagrid. I understand how to add datasources and that sort of thing, or at least I am starting to get it. But my question is about manipulating individual rows or cells. Is that only possible during the databind event handler, that is the only place I have been able to do it so far. I am sure there is a more abstract way of doing the things I want to do, but there are times where I just want to say Datagrid.add(row). I mean, if the datagrid is made up of a certain object type, can I make a new object of that type and just chuck it on the end? I am still new to this stuff, so perhaps what I want to do would defeat the purpose of this added abstraction, but figured I would ask around. Thanks for any advice, tips, or tricks people feel like sharing. Edit: for clarification I am using c#, entity framework, asp.net, and an SQL database.

    Read the article

  • Error 3032 during EF 4.0 validation

    - by Mohammadreza
    Hi guys. I have a table that has a column called "rowguid" with default value of newguid(). After I delete the generated property in the Entity Framework 4.0 designer, whenever I try to build or validate the model I receive the following error message. Error 3023: Problem in mapping fragments starting at line 1460:Column People.rowguid in table People must be mapped: It has no default value and is not nullable. It's an obvious error message but the problem is that the column HAS default value. Does anyone knows what the problem is? Thanks.

    Read the article

< Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >