Search Results

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

Page 106/397 | < Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >

  • Linq with EF dynamic search

    - by malik
    I am using EF 3.5 with MVC. I want to made a search page, has some fields for criteria like date, int etc. What is the way in linq to entities to filter the result dynamically. If there are one parameter we can use .where(a=a.id==1) but many combination with optional param how can i load results and then pass to model.

    Read the article

  • linq include with condition

    - by user276640
    i have function public Menu Details(int? id) { return _dataContext.Menu.Include("ChildMenu").FirstOrDefault(m => m.MenuId == id); } now i need to add condition to child list ChildMenu something like fieldname=id. how can i do it?

    Read the article

  • EntityFramework: Access dabase-column using user defined Type

    - by Nils
    I "inherited" an old Database where dates are stored as Int32 values (times too, but dates shall suffice for this example) i.e. 20090101 for Jan. 1st 2009. I can not change the schema of this database because it is still accessed by the old programs. However I want to write a new program using EF as the O/R-M. Now I'd love to have DateTime-Values in my Model. Is there a way to write a custom type and use this as a Type in the EF-Model. Something like a Type "OldDate" with properties: DatabaseValue : Int23 Value : DateTime (specifying the date-part whereas the time-part is always 0:00:00) Is something like this possible with the EF-Model ?

    Read the article

  • Authentication Problem in Silverlight - Cannot connect to SQL Server

    - by Johann
    Hi All, At the moment, when I try to register a user using the default Business Template in Silverlight, I am getting an error. Basically I am following a tutorial found on Channel 9 on how to build a business app with Silverlight. "An error has occurred while establishing a connection to the server. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 5) An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 1326)". I found a blog where it identifies the problem, and followed every step, however I am still getting the same problems. Here is my connection string:- <add name="SIEventManagerEntities" connectionString="metadata=res://*/EventManagerDBModel.csdl|res://*/EventManagerDBModel.ssdl|res://*/EventManagerDBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=MONFU-PC;Initial Catalog=SIEventManager;Integrated Security=SSPI;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" /> Any help would really be very much appreciated! Thanks

    Read the article

  • Disambiguating Named Entities in Java

    - by Alterscape
    I have a list of strings (company names, in this case), and a Java program that extracts a list of things that look like company names out of mostly-unstructured text. I need to match each element of extracted text to a string in the list. Caveat: the unstructured text has typos, things like "Blah, Inc." referred to as "Blah," etc. I've tried Levenshtein Edit Distance, but that fails for predictable reasons. Are there known best-practices ways of tackling this problem? Or am I back to manual data-entry?

    Read the article

  • Custom authorize using MVC

    - by Karsten
    Im working a bit with MVC. I need to know something about roles when using the same controller for several users getting and showing pictures. I need to show pictures, but sometimes these pictures should only be shown for those who created them. So now when using the Authorize attribute and if picture and username match thrue my databse I could ofcause use this to make a match. I could ofcause make a match method in the controller. [Authorize] controllGetPicture(Picture ID){ getSomepicture.. return picture } DB relations Relations [User] <- [Pictures] ID FK_UserID Im thinking about just getting the User ID and compare with the Picture FK_UserId at the picture but I think it could be smarter. How?

    Read the article

  • Beginner Question on traversing a EF4 model

    - by user564577
    I have a basic EF4 model with two entities. I'm using Self Tracking Entities Client has ClientAddresses relationship on clientkey = clientkey. (1 to many) How do i get a list/collection of client entities (STE) and their addresses (STE) but only ones where they live in a particular state or some such filter on the address??? This seems to filter and bring back clients but doesnt bring back addresses. var j = from client in context.Clients where client.ClientAddresses.All(c => c.ZIP == "80923") select client; I cant get this to create the Addresses because ClientAddresses is IEnumerable and it needs a TrackableCollection var query = from t1 in context.Clients join t2 in context.ClientAddresses on t1.ClientKey equals t2.ClientKey where t2.ZIP == "80923" select new Client { FirstName = t1.FirstName, LastName = t1.LastName, IsEnabled = t1.IsEnabled, ClientKey = t1.ClientKey, ChangeUser = t1.ChangeUser, ChangeDate = t1.ChangeDate, ClientAddresses = from a in t1.ClientAddresses select new ClientAddress { AddressKey = a.AddressKey, AddressLine1 = a.AddressLine1, AddressLine2 = a.AddressLine2, AddressTypeCode = a.AddressTypeCode, City = a.City, ClientKey = a.ClientKey, State = a.State, ZIP = a.ZIP } }; Any pointers would be appreciated. Thanks Edit: This seems to work.... var j = from client in context.Clients.Include("ClientAddresses") where client.ClientAddresses.Any(c => c.ZIP == "80923") select client;

    Read the article

  • How big teams work with database

    - by Michael Riva
    Lets say I have a team, 20 developers. And we are making a project on .net. In team every one can easy create their tables according to their modules working on it. And we think to use an ORM, can you tell me how can and which ORM tools for good to working with team. Is there any proven way? I m asking becouse I never work with a team, so I dont know the best practices. So you guys what kind of pattern you use?. I realy wonder. The team members can write their unit tests and supply necessary design patterns. What kind of approach I need to create to manage team? What kind of ORM tools that we have to use?

    Read the article

  • setMessage for Zend_Validate_EmailAddress doesn't work

    - by iSenne
    Hello everybody. I have a form and I want to set my custom errors in it. I am using Zend, and I have the following code... //Create validators $formMustBeEmail = new Zend_Validate_EmailAddress(); $formMustBeEmail->setMessage(array( Zend_Validate_EmailAddress::INVALID => "1. Invalid type given, value should be a string", Zend_Validate_EmailAddress::INVALID_FORMAT => "2. '%value%' is no valid email address in the basic format local-part@hostname", Zend_Validate_EmailAddress::INVALID_HOSTNAME => "3. '%hostname%' is no valid hostname for email address '%value%'", Zend_Validate_EmailAddress::INVALID_MX_RECORD => "4. '%hostname%' does not appear to have a valid MX record for the email address '%value%'", Zend_Validate_EmailAddress::INVALID_SEGMENT => "5. '%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network.", Zend_Validate_EmailAddress::DOT_ATOM => "6. '%localPart%' can not be matched against dot-atom format", Zend_Validate_EmailAddress::QUOTED_STRING => "7. '%localPart%' can not be matched against quoted-string format", Zend_Validate_EmailAddress::INVALID_LOCAL_PART => "8. '%localPart%' is no valid local part for email address '%value%'", Zend_Validate_EmailAddress::LENGTH_EXCEEDED => "9. '%value%' exceeds the allowed length", Then I make the form... $this->addElement('text', 'email'); $emailElement = $this->getElement('email'); $emailElement ->setLabel('Emailadres') ->setOrder(1) ->setRequired(true) ->addValidator($formMustBeTest) ->addValidator($formMustBeEmail) ->addFilter(new Zend_Filter_StripTags()); But it doesn't work. I still get the normal errors made by Zend. Can anyone see what I am doing wrong? Tnx in advanced...

    Read the article

  • access EF classes from a Class Library - exactly how do configure/test the connection string in the

    - by Greg
    Hi, I'm getting very confused about how to call my EF classes in a Class Library from the Client Project I have? Things worked fine when they were in the same project. Now I'm getting errors such as "Unable to load the specified metadata resource ". I've see various ideas / suggestions re how to fix the connection string (e.g. create an App.config in your client project & copy the connection string config from your class library, something about change the connection settings to copy to output, etc) QUESTION - Can someone provide a solid way on how to get EF class access from a separate project working? (i.e. how to get the correct connection information to the client somehow) thanks

    Read the article

  • Full stack framework for Java

    - by Jonathan Barbero
    Hello everyone, I'm looking for a full stack framework (from persistency to view generation (CRUD)) for Java. I don't have experience with Rails style frameworks, like Grails, but I worked a lot with Hibernate, Struts, Spring ... I prefer a framework that let you naturally modify the business domain design with the less effort ( i.e. writing the sql querys to modify the tables and constrains, change the view pages, etc ... ). I was looking a bit about this topic, I saw Naked Objects for example but its development has stopped. So, I want to hear about your experience. Thanks in advance.

    Read the article

  • moving EDMX file System.Data.MetadataException: Unable to load the specified metadata resource.

    - by Dani
    I have a ASP.NET MVC 2 project. I've created edmx file on the class library project that holds the model. now I've created another class library called it shared and moved the edmx file over there. resolved some issues, everything compiles, but it can't find the connection string resource at runtime. I've copied the ConnectionString part of the Web.Config to the main file, the old class library app.config file and the new class library app.config file. Still get this error: System.Data.MetadataException: Unable to load the specified metadata resource. Line 75: public myProjdb() : base("name=myProjdb", "MyProjdb") in the MyProj.Designer.cs file. Any Idea how to resolve this issue ? Is there a better way to store connection string data ?

    Read the article

  • What setup in .Net would most resemble Django

    - by Mingus Rude
    At work we are inte process of starting development on a new web-based product. Before doing so we need to establish what technology stack we are going to use. For this application my preference would have been to use Django but since the development- and management-team is soo heavily rooted with Microsoft the new product will have to be based on Microsoft technologies. So my question is, what setup, with Microsoft technologies, would most resemble a django setup with its MVT-design?

    Read the article

  • Inefficient 'ANY' LINQ clause

    - by Focus
    I have a query that pulls back a user's "feed" which is essentially all of their activity. If the user is logged in the query will be filtered so that the feed not only includes all of the specified user's data, but also any of their friends. The database structure includes an Actions table that holds the user that created the action and a UserFriends table which holds any pairing of friends using a FrienderId and FriendeeId column which map to UserIds. I have set up my LINQ query and it works fine to pull back the data I want, however, I noticed that the query gets turned into X number of CASE clauses in profiler where X is the number of total Actions in the database. This will obviously be horrible when the database has a user base larger than just me and 3 test users. Here's the SQL query I'm trying to achieve: select * from [Action] a where a.UserId = 'GUID' OR a.UserId in (SELECT FriendeeId from UserFriends uf where uf.FrienderId = 'GUID') OR a.UserId in (SELECT FrienderId from UserFriends uf where uf.FriendeeId = 'GUID') This is what I currently have as my LINQ query. feed = feed.Where(o => o.User.UserKey == user.UserKey || db.Users.Any(u => u.UserFriends.Any(ufr => ufr.Friender.UserKey == user.UserKey && ufr.isApproved) || db.Users.Any(u2 => u2.UserFriends.Any(ufr => ufr.Friendee.UserKey == user.UserKey && ufr.isApproved) ))); This query creates this: http://pastebin.com/UQhT90wh That shows up X times in the profile trace, once for each Action in the table. What am I doing wrong? Is there any way to clean this up?

    Read the article

  • Why doesn't this CompiledQuery give a performance improvement?

    - by Grammarian
    I am trying to speed up an often used query. Using a CompiledQuery seemed to be the answer. But when I tried the compiled version, there was no difference in performance between the compiled and non-compiled versions. Can someone please tell me why using Queries.FindTradeByTradeTagCompiled is not faster than using Queries.FindTradeByTradeTag? static class Queries { // Pre-compiled query, as per http://msdn.microsoft.com/en-us/library/bb896297 private static readonly Func<MyEntities, int, IQueryable<Trade>> mCompiledFindTradeQuery = CompiledQuery.Compile<MyEntities, int, IQueryable<Trade>>( (entities, tag) => from trade in entities.TradeSet where trade.trade_tag == tag select trade); public static Trade FindTradeByTradeTagCompiled(MyEntities entities, int tag) { IQueryable<Trade> tradeQuery = mCompiledFindTradeQuery(entities, tag); return tradeQuery.FirstOrDefault(); } public static Trade FindTradeByTradeTag(MyEntities entities, int tag) { IQueryable<Trade> tradeQuery = from trade in entities.TradeSet where trade.trade_tag == tag select trade; return tradeQuery.FirstOrDefault(); } }

    Read the article

  • Problem in mutiple :dependent=> :destroy when multiple polymorphic is true

    - by piemesons
    I have four models question, answer, comment and vote.Consider it same as stackoverflow. Question has_many comments Answers has_many comments Questions has_many votes answers has_many votes comments has_many votes Here are the models (only relevant things) class Comment < ActiveRecord::Base belongs_to :commentable, :polymorphic => true has_many :votes, :as => :votable, :dependent => :destroy end class Question < ActiveRecord::Base has_many :comments, :as => :commentable, :dependent => :destroy has_many :answers, :dependent => :destroy has_many :votes, :as => :votable, :dependent => :destroy end class Vote < ActiveRecord::Base belongs_to :votable, :polymorphic => true end class Answer < ActiveRecord::Base belongs_to :question, :counter_cache => true has_many :comments, :as => :commentable , :dependent => :destroy end Now the problem is whenever i am trying to delete any question/answer/comment its giving me an error NoMethodError in QuestionsController#destroy undefined method `each' for 0:Fixnum if i remove this line from any of the model (question/answer/comment) has_many :votes, :as => :votable, :dependent => :destroy then it works perfectly. It seems there is a problem while deleting the records active record is not able to find out the proper path because of multiple joins within the tables.

    Read the article

  • Not loading the object caused EF4 (code first) to remove the relationship

    - by Lavinski
    Firstly this is a EF4: Code First - Property Loading question. I'm loading an object like so var item = Context.Table.Find( update.Identifier ); This object has a property Relationship so a table has a Relationship object. Now i'm updating my item but my Relationship object is not toched (and therefore not lazy loaded). Now here's the problem .. I save my item and my relationship to the Relationship object is deleted, apparently the model thinks i set it to null. However it all works if I look at the property before saving. So I'm looking into LoadProperty or doing a query and using Include. Has anyone else come across this issue and how did you get around it?

    Read the article

  • IPhone CoreData: How should I relate many child entities to thier parents

    - by Robert
    I am trying to import data from a database that uses primary key / forign key relations to a core data database in Xcode. I have code that creates hundreds of child entities in a managed object context: Each child has an ID that corresponds to a parent. child1 parentID = 3 child2 parentID = 17 child3 parentID = 17 ... childn parentID = 5 I now need to relate each child to its parent. The parents are all stored in persistent memory. My first thought was to preform a fetch for each child to get its parent. However, I think this would be slow. Am I correct? How should I do this instead?

    Read the article

  • ASP.NET MVC4: How do I keep from having multiple identical results in my lookup tables

    - by sehummel
    I'm new to ASP.NET so this may be an easy question. I'm seeding my database with several rows of dummy data. Here is one of my rows: new Software { Title = "Microsoft Office", Version = "2012", SerialNumber = "12346231434543", Platform = "PC", Notes = "Macs really rock!", PurchaseDate = "2011-12-04", Suite = true, SubscriptionEndDate = null, SeatCount = 0, SoftwareTypes = new List<SoftwareType> { new SoftwareType { Type="Suite" }}, Locations = new List<Location> { new Location { LocationName = "Paradise" }}, Publishers = new List<SoftwarePublisher> { new SoftwarePublisher { Publisher = "Microsoft" }}} But when I do this, a new row is created for each location, with the LocationName being set in each row like this. We only have two locations. How do I get it to create a LocationID property for the Software class and in my Locations class. Here is my Location class: public class Location { public int Id { get; set; } [Required] [StringLength(20)] public string LocationName { get; set; } public virtual Software Software { get; set; } } I have this line in my Software class to reference this table: public virtual List<Location> Locations { get; set; } Again, what I want when I am done is a Locations table with two entries, and a LocationID field in my Software table. How do I do this?

    Read the article

  • How can I use EF in windows forms to insert new data ?

    - by Al0NE
    Hi Maybe it's simple question, but it's my first time with EF + win app so ... I'm building win app with EF by adding edmx as data source then drag and drop the tables to get navigator and binding source .. when I press the add button in the navigator it allows me to enter new data but when I save the context I get NULL data for all fields except the auto increment field ( the ID field ).... What should I do to save many entries ...? DO I have to loop over all the entities in the binding source and add them to the context ?? Thanx in advance Update: I forgot to say that when i use data grid view it adds the items correctly but with "Details" it didn't ..

    Read the article

  • Create Views for object properties in model in MVC 3 application?

    - by Anders Svensson
    I have an Asp.Net MVC 3 application with a database "Consultants", accessed by EF. Now, the Consultant table in the db has a one-to-many relationship to several other tables for CV type information (work experience, etc). So a user should be able to fill in their name etc once, but should be able to add a number of "work experiences", and so on. But these foreign key tables are complex objects in the model, and when creating the Create View I only get the simple properties as editor fields. How do I go about designing the View or Views so that the complex objects can be filled in as well? I picture a View in my mind where the simple properties are simple fields, and then some sort of control where you can click "add work experience", and as many as needed would be added. But how would I do that and still utilize the model binding? In fact, I don't know how to go about it at all. (BTW, Program and Language stand for things like software experience in general, and natural language competence, not programming languages, in case you're wondering about the relationships there). Any ideas greatly appreciated! Here's the Create View created by the add View command by default: @{ ViewBag.Title = "Create"; } <h2>Create</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> @using (Html.BeginForm()) { @Html.ValidationSummary(true) <fieldset> <legend>Consultant</legend> <div class="editor-label"> @Html.LabelFor(model => model.FirstName) </div> <div class="editor-field"> @Html.EditorFor(model => model.FirstName) @Html.ValidationMessageFor(model => model.FirstName) </div> <div class="editor-label"> @Html.LabelFor(model => model.LastName) </div> <div class="editor-field"> @Html.EditorFor(model => model.LastName) @Html.ValidationMessageFor(model => model.LastName) </div> <div class="editor-label"> @Html.LabelFor(model => model.UserName) </div> <div class="editor-field"> @Html.EditorFor(model => model.UserName) @Html.ValidationMessageFor(model => model.UserName) </div> <div class="editor-label"> @Html.LabelFor(model => model.Description) </div> <div class="editor-field"> @Html.EditorFor(model => model.Description) @Html.ValidationMessageFor(model => model.Description) </div> <p> <input type="submit" value="Create" /> </p> </fieldset> } <div> @Html.ActionLink("Back to List", "Index") </div> And here's the EF database diagram:

    Read the article

  • Reduce the number of queries in EF

    - by Gio2k
    I have the following Model: Entities: Product (Contains basic data for products: price, etc) Attribute (Contains data for all possible optional attributes) ProductAttribute (Contains data for optional attributes of a product, eg. Color, Model, Size). ProductAttribute is essentially a many to many relationship with payload (ProductId, AttributeID, Value) And this piece of code: private static void ListAttributes(Product p) { p.ProductAttributes.Load(); foreach (var att in p.ProductAttributes) { att.Attribute.load(); Console.WriteLine("\tAttribute Name:{0} - Value {1}", att.Attribute.Name, att.AttributeValue); } } This piece of code will fire a query for each time the att.Attribute.Load() method is called in the foreach loop, only so i can get display the name of the attribute. I would like to fetch the Attribute.Name together with the query that fetches all attribute values, i.e. join ProductAttribute and Attribute. Is there any way to achieve this within my method?

    Read the article

  • Shaping EF LINQ Query Results Using Multi-Table Includes

    - by sisdog
    I have a simple LINQ EF query below using the method syntax. I'm using my Include statement to join four tables: Event and Doc are the two main tables, EventDoc is a many-to-many link table, and DocUsage is a lookup table. My challenge is that I'd like to shape my results by only selecting specific columns from each of the four tables. But, the compiler is giving a compiler is giving me the following error: 'System.Data.Objects.DataClasses.EntityCollection does not contain a definition for "Doc' and no extension method 'Doc' accepting a first argument of type 'System.Data.Objects.DataClasses.EntityCollection' could be found. I'm sure this is something easy but I'm not figuring it out. I haven't been able to find an example of someone using the multi-table include but also shaping the projection. Thx,Mark var qry= context.Event .Include("EventDoc.Doc.DocUsage") .Select(n => new { n.EventDate, n.EventDoc.Doc.Filename, //<=COMPILER ERROR HERE n.EventDoc.Doc.DocUsage.Usage }) .ToList(); EventDoc ed; Doc d = ed.Doc; //<=NO COMPILER ERROR SO I KNOW MY MODEL'S CORRECT DocUsage du = d.DocUsage;

    Read the article

< Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >