Search Results

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

Page 109/397 | < Previous Page | 105 106 107 108 109 110 111 112 113 114 115 116  | Next Page >

  • Search a List inside another with IQueryable

    - by ovini poornima
    public static IQueryable<Institution> WithFunds(this IQueryable<Institution> query, IEnumerable<Fund> allowedFunds) { return query. } I want to get the query to return all Institutions having any of the Fund given in 'allowedFunds' list in Institution.Funds. Please help. My class hierarchy goes like this. public partial class Institution { public int Id { get; set; } public virtual ICollection<Fund> Funds { get; set; } } public partial class Fund { public int Id { get; set; } public virtual Institution Institution { get; set; } }

    Read the article

  • Please help translate this in linq to ef

    - by user3487644
    StringBuilder sb = new StringBuilder(); sb.AppendLine("SELECT"); sb.AppendLine(String.Format(" (SELECT TOP 1 CAST(ProspectID AS VARCHAR(5)) FROM Lead_Import_Fail Where ProspectID < {0} AND ProspectFullName = '{1}')", Convert.ToInt64(lead.LeadID), lead.Name)); sb.AppendLine(String.Format(", (SELECT TOP 1 CAST(ProspectID AS VARCHAR(5)) FROM Lead_Import_Fail Where ProspectID < {0} AND ProspectNRICPassport = '{1}')", Convert.ToInt64(lead.LeadID), lead.NRIC)); Thanks in advance.

    Read the article

  • How do I use 2 include statements in a single MVC EF query?

    - by alockrem
    I am trying to write a query that includes 2 joins. 1 StoryTemplate can have multiple Stories 1 Story can have multiple StoryDrafts I am starting the query on the StoryDrafts object because that is where it's linked to the UserId. I don't have a reference from the StoryDrafts object directly to the StoryTemplates object. How would I build this query properly? public JsonResult Index(int userId) { return Json( db.StoryDrafts .Include("Story") .Include("StoryTemplate") .Where(d => d.UserId == userId) ,JsonRequestBehavior.AllowGet); } Thank you for any help.

    Read the article

  • Doctrine join enitiy or null

    - by Medvedev
    I have an entity Entity\User with avatar: /** * @ORM\OneToOne(targetEntity="Entity\Avatar", cascade={"remove"}, fetch="LAZY") */ protected $avatar; And Entity\Message entity /** * @ORM\ManyToOne(targetEntity="Entity\User") */ protected $user; When i try to load all messages with users and avatars. But not all user have avatar. SELECT m, u, a FROM Entity\Message m JOIN m.user u JOIN u.avatar a ORDER BY m.id DESC How to load all messages with user who avatars and who does not have?

    Read the article

  • Scala: recursive search avoiding cycles

    - by user1826663
    How can I write a recursive search that I avoid cycles. My class is this: class Component(var name: String, var number: Int, var subComponent: Set[Component]) Now I need a way to check whether a component is contained within its subcomponent or between subcomponent of its subcomponent and so on.Avoiding possible cycles caused by other Component. My method of recursive search must have the following signature, where subC is the Set [component] of comp. def content (comp: Component, subC: Set[Component]) : Boolean = { } Thanks for the help.

    Read the article

  • HELP PLEASE!!!! External component has thrown an exception. ASP.NET ASPX PAGE POST

    - by Brandon
    I have an aspx page that communicates with a webservice I have. It connects to an SQL Server database on my virtual dedicated server. With just a little usage, I get this error External component has thrown an exception. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.SEHException: External component has thrown an exception. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SEHException (0x80004005): External component has thrown an exception.] Luxand.FSDK.Initialize(String DataFilesPath) +0 WebService.onLoad() +70 WebService..ctor() +91 facematch.btn_submit_Click(Object sender, EventArgs e) +218 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

    Read the article

  • External component has thrown an exception. ASP.NET ASPX PAGE POST

    - by Brandon
    I have an aspx page that communicates with a webservice I have. It connects to an SQL Server database on my virtual dedicated server. With just a little usage, I get this error External component has thrown an exception. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.SEHException: External component has thrown an exception. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SEHException (0x80004005): External component has thrown an exception.] Luxand.FSDK.Initialize(String DataFilesPath) +0 WebService.onLoad() +70 WebService..ctor() +91 facematch.btn_submit_Click(Object sender, EventArgs e) +218 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

    Read the article

  • Fetch request error: no entity? Probably easy, but help!

    - by cksubs
    Hi, I'm going through the Stanford iPhone course. I'm on the second Paparazzi assignment. I'm getting this error: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'executeFetchRequest:error: A fetch request must have an entity.' I've copied a lot of the code from this walkthrough site. Running his source code works perfectly, and at this point my code is pretty much exactly the same as his. But it throws that error. See below for the relavent bits: // Create FetchRequest NSFetchRequest *request = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Person" inManagedObjectContext:context]; [request setEntity:entity]; // Set the sort descriptor NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"personName" ascending:NO]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil]; [request setSortDescriptors:sortDescriptors]; [sortDescriptors release]; [sortDescriptor release]; // set up NSFetchedResultsController to hold the fetch NSFetchedResultsController *frc = [[NSFetchedResultsController alloc] initWithFetchRequest:request managedObjectContext:context sectionNameKeyPath:nil cacheName:@"personCache"]; // execute the fetch NSError *error; NSLog(@"Prints Here"); [frc performFetch:&error]; NSLog(@"Doesn't Print Here"); I'm clearly setting the entity with [request setEntity:entity]. So the error has me stumped. Is there something I'm missing? Maybe in another file? I don't know. I'm still so confused with Objective-C.... Thanks.

    Read the article

  • How to define index by several columns in hibernate entity?

    - by foobar
    Morning. I need to add indexing in hibernate entity. As I know it is possible to do using @Index annotation to specify index for separate column but I need an index for several fields of entity. I've googled and found jboss annotation @Table, that allows to do this (by specification). But (I don't know why) this functionality doesn't work. May be jboss version is lower than necessary, or maybe I don't understant how to use this annotation, but... complex index is not created. Why index may not be created? jboss version 4.2.3.GA Entity example: package somepackage; import org.hibernate.annotations.Index; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity @org.hibernate.annotations.Table(appliesTo = House.TABLE_NAME, indexes = { @Index(name = "IDX_XDN_DFN", columnNames = {House.XDN, House.DFN} ) } ) public class House { public final static String TABLE_NAME = "house"; public final static String XDN = "xdn"; public final static String DFN = "dfn"; @Id @GeneratedValue private long Id; @Column(name = XDN) private long xdn; @Column(name = DFN) private long dfn; @Column private String address; public long getId() { return Id; } public void setId(long id) { this.Id = id; } public long getXdn() { return xdn; } public void setXdn(long xdn) { this.xdn = xdn; } public long getDfn() { return dfn; } public void setDfn(long dfn) { this.dfn = dfn; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } } When jboss/hibernate tries to create table "house" it throws following exception: Reason: org.hibernate.AnnotationException: @org.hibernate.annotations.Table references an unknown table: house

    Read the article

  • Is it possible to build a JPA entity by extending a POJO?

    - by Freiheit
    Lets say I have the following POJO: public class MyThing { private int myNumber; private String myData; //assume getter/setter methods } Is it now possible to extend this POJO as a JPA entity? @Entity @Table(name = "my_thing") public class MyThingEntity extends MyThing implements Serializable { @Column(name = "my_number") //????????? @Column(name = "my_data") //???????? } I want to keep the POJO separate from the JPA entity. The POJO lives in a different project and is often used without a persistence layer, my project wants to persist it in a database and do so without the overhead of mapping from a POJO to an entity and back. I understand that JPA entities are POJOs, but in order to use it I would have to include a library that implements javax.persistence and the other projects using the same base object have no use for a persistence layer. Is this possible? Is this a good idea?

    Read the article

  • An attempt has been made to Attach or Add an entity that is not new Linq to Sql error

    - by Collin Oconnor
    I have a save function for my order entity that looks like this and it breaks on the sumbmitChanges line: public void SaveOrder ( Order order ) { if (order.OrderId == 0) orderTable.InsertOnSubmit(order); else if (orderTable.GetOriginalEntityState(order) == null) { orderTable.Attach(order); orderTable.Context.Refresh(RefreshMode.KeepCurrentValues , order); } orderTable.Context.SubmitChanges(); } The order entity contains two other entities; an Address entity and a credit card entity. Now i want these two entities to be null sometimes. Now my guess for why this is throwing an error is because that both of these entites that are inside order are null. If this is the case, How can I insert an new order into the database with both entities (Address and creditCard) being null.

    Read the article

  • How to know if a detached JPA entity has already been persisted or not ?

    - by snowflake
    I have a JPA entity instance in the web UI layer of my application. I'd like to know at anytime if this entity has been already persisted in database or if it is only present in the user session. It would be in the business layer, I would use entitymanager.contains(Entity) method, but in my UI layer I think I need an extra attribute indicating whether the entity has been saved or not. How implement that ? I'm considering following option for the moment: - a JPA attribute with a default value set by the database, but would force a new read after each update ? - a non JPA attribute manually set in my code or automatically set by JPA? Any advice / other suggestions ? I'm using JPA 1 with Hibernate 3.2 implementation and would prefer stick to the standard.

    Read the article

  • Why can't I start XML entity names with 'xml''?

    - by flamey
    <XmlInfo /> I ran into problem using Perl's popular SOAP::Lite module, where it wouldn't accept XML entity names starting with "xml" (regardles letters' case). The author of the module replied to email saying that entity names starting with "xml" are not permitted in XML specification, but I couldn't find it in W3C's documents for 1.0 and 1.1 specs, I also couldn't find it in any of the articles or guidelines docs about XML entity naming. In fact some guideline documents used names starting with xml as an example, and lots of people are using it, as I see via Google Code Search. So are there any restrictions (besides which characters to use as defined in W3C's documents) in Entity naming in XML? Is there a restriction saying you can't name entities starting with "xml"?

    Read the article

  • How can I save an ASP.NET IFRAME from a custom entity's OnSave event, reliably?

    - by Forgotten Semicolon
    I have a custom ASP.NET solution deployed to the ISV directory of an MS Dynamics CRM 4.0 application. We have created a custom entity, whose data entry requires more dynamism than is possible through the form builder within CRM. To accomplish this, we have created an ASP.NET form surfaced through an IFRAME on the entity's main form. Here is how the saving functionality is currently laid out: There is an ASP.NET button control on the page that saves the entity when clicked. This button is hidden by CSS. The button click event is triggered from the CRM OnSave javascript event. The event fires and the entity is saved. Here are the issues: When the app pool is recycled, the first save (or few) may: not save be delayed (ie. the interface doesn't show an update, until the page has been refreshed after a few sec) Save and Close/New may not save For issue 1.1 and 2, what seems to be happening is that while the save event is fired for the custom ASP.NET page, the browser has moved on/refreshed the page, invalidating the request to the server. This results in the save not actually completing. Right now, this is mitigated with a kludge javascript delay loop for a few seconds after calling the button save event, inside the entity OnSave event. Is there any way to have the OnSave event wait for a callback from the IFRAME?

    Read the article

  • Get an Entity in Save Method, What is correct form ?

    - by Felipe
    Hi everybody I'm begginer in asp.net mvc and i have some doubts. P.S: I'm using DDD to learn I have an ACtion in a Controller and it'll save an entity (from my model) by a repository (for a database). My doubts is, How can I get the informations from the View and save it by a repository in my Controller ? Is it correct to get an entity of my Model in Save method of controller, like this: public ActionResult Save(Product product) { // validate object // save data in repository return View("Success"); } Or Need I get an DTO (with a structure similar to my entity) and create an object passing property by property to an entity ? I didnt' like of FormCollection and I'd like to know, What is recommended architecturally ? Thanks a lot guys Cheers

    Read the article

  • JPA - Can I create an Entity class, using an @DiscriminatorValue, that doesn't have its own table?

    - by DaveyDaveDave
    Hi - this is potentially a bit complex, so I'll do my best to describe my situation - it's also my first post here, so please forgive formatting mistakes, etc! I'm using JPA with joined inheritance and a database structure that looks like: ACTION --------- ACTION_ID ACTION_MAPPING_ID ACTION_TYPE DELIVERY_CHANNEL_ACTION -------------------------- ACTION_ID CHANNEL_ID OVERRIDE_ADDRESS_ACTION -------------------------- ACTION_ID (various fields specific to this action type) So, in plain English, I have multiple different types of action, all share an ACTION_MAPPING, which is referenced from the 'parent' ACTION table. DELIVERY_CHANNEL_ACTION and OVERRIDE_ADDRESS_ACTION both have extra, supplementary data of their own, and are mapped to ACTION with a FK. Real-world, I also have a 'suppress' action, but this doesn't have any supplementary data of its own, so it doesn't have a corresponding table - all it needs is an ACTION_MAPPING, which is stored in the ACTION table. Hopefully you're with me so far... I'm creating a new project from scratch, so am pretty flexible in what I can do, but obviously would like to get it right from the outset! My current implementation, which works, has three entities loosely defined as follows: @Entity @Table(name="ACTION") @Inheritance(strategy=InheritanceType.JOINED) @DiscriminatorValue("SUPPRESS") public class Action @Entity @Table(name="DELIVERY_CHANNEL_ACTION") @DiscriminatorValue("DELIVERY_CHANNEL") public class DeliveryChannelAction extends Action @Entity @Table(name="OVERRIDE_ADDRESS_ACTION") @DiscriminatorValue("OVERRIDE_ADDRESS") public class OverrideAddressAction extends Action That is - I have a concrete base class, Action, with a Joined inheritance strategy. DeliveryChannelAction and OverrideAddressAction both extend Action. What feels wrong here though, is that my Action class is the base class for these two actions, but also forms the concrete implementation for the suppress action. For the time being this works, but at some point more actions are likely to be added, and there's every chance that some of them will, like SUPPRESS, have no supplementary data, which will start to get difficult! So... what I would like to do, in the object model world, is to have Action be abstract, and create a SuppressAction class, which is empty apart from having a @DiscriminatorValue("SUPPRESS"). I've tried doing exactly what is described above, so, changing Action to: @Entity @Table(name="ACTION") @Inheritance(strategy=InheritanceType.JOINED) public abstract class Action and creating: @DiscriminatorValue("SUPPRESS") public class SuppressAction extends Action but no luck - it seems to work fine for DeliveryChannelAction and OverrideAddressAction, but when I try to create a SuppressAction and persist it, I get: java.lang.IllegalArgumentException: Object: com.mypackage.SuppressAction[actionId=null] is not a known entity type. at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:4147) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:368) at com.mypackage.test.util.EntityTestUtil.createSuppressAction(EntityTestUtil.java:672) at com.mypackage.entities.ActionTest.testCRUDAction(ActionTest.java:27) which I assume is down to the fact that SuppressAction isn't registered as an entity, but I don't know how I can do that, given that it doesn't have an associated table. Any pointers, either complete answers or hints for things to Google (I'm out of ideas!), most welcome :) EDIT: to correct my stacktrace.

    Read the article

  • Unable to update the EntitySet because it has a DefiningQuery and no &lt;UpdateFunction&gt; element

    - by Harish Ranganathan
    When working with ADO.NET Entity Data Model, its often common that we generate entity schema for more than a single table from our Database.  With Entity Model generation automated with Visual Studio support, it becomes even tempting to create and work entity models to achieve an object mapping relationship. One of the errors that you might hit while trying to update an entity set either programmatically using context.SaveChanges or while using the automatic insert/update code generated by GridView etc., is “Unable to update the EntitySet <EntityName> because it has a DefiningQuery and no <UpdateFunction> element exists in the <ModificationFunctionMapping> element to support the current operation” While the description is pretty lengthy, the immediate thing that would come to our mind is to open our the entity model generated code and see if you can update it accordingly. However, the first thing to check if that, if the Entity Set is generated from a table, whether the Table defines a primary key.  Most of the times, we create tables with primary keys.  But some reference tables and tables which don’t have a primary key cannot be updated using the context of Entity and hence it would throw this error.  Unless it is a View, in which case, the default model is read-only, most of the times the above error occurs since there is no primary key defined in the table. There are other reasons why this error could popup which I am not going into for the sake of simplicity of the post.  If you find something new, please feel free to share it in comments. Hope this helps. Cheers !!!

    Read the article

  • Simultaneous AI in turn based games

    - by Eduard Strehlau
    I want to hack together a roguelike. Now I thought about entity and world representation and got to a quite big problem. If you want all the AI to act simultaneously you would normally(in cellular automa for examble) just copy the cell buffer and let all action of indiviual cells depend on the copy. Actions which are not valid anymore after some cell before the cell you are currently operating on changed the original enviourment(blocking the path) are just ignored or reapplied with the "current"(between turns) environment. After all cells have acted you copy the current map to the buffer again. Now for an environment with complex AI and big(datawise) entities the copying would take too long. So I thought you could put every action and entity makes into a que(make no changes to the environment) and execute the whole que after everyone took their move. Every interaction on this que are realy interacting entities, so if a entity tries to attack another entity it sends a message to it, the consequences of the attack would be visible next turn, either by just examining the entity or asking the entity for data. This would remove problems like what happens if an entity dies middle in the cue but got actions or is messaged later on(all messages would go to null, and the messages from the entity would either just be sent or deleted(haven't decided yet) But what would happen if a monster spawns a fireball which by itself tracks the player(in the same turn). Should I add the fireball to the enviourment beforehand, so make a change to the environment before executing the action list or just add the ball to the "need updated" list as a special case so it doesn't exist in the environment and still operates on it, spawing after evaluating the action list? Are there any solutions or papers on this subject which I can take a look at? EDIT: I don't need information on writing a roguelike I need information on turn based ai in respective to a complex enviourment.

    Read the article

  • Making Modular, Reusable and Loosely Coupled MVC Components

    - by Dusan
    I am building MVC3 application and need some general guidelines on how to manage complex client side interaction between my components. Here is my definition of one component in general way: Component which has it's own controller, model and view. All of the component's logic is placed inside these three parts and component is sort of "standalone", it contains it's own form, data needed for interaction, updates itself with Ajax and so on. Beside this internal logic and behavior of the component, it needs to be able to "Talk" to the outside world. By this I mean it should provide data and events (sort of) so when this component gets embedded in pages can notify other components which then can update based on the current state and data. I have an idea to use client ViewModel (in java-script) which would hookup all relevant components on page and control interaction between them. This would make components reusable, modular - independent of the context in which they are used. How would you do this, I am a bit stuck as I do not know if this is a good approach and there is a technical possibility to achieve this using java-script/jquery. The confusing part is about update via Ajax, how to ensure that component is properly linked to ViewModel when component is Ajax updated (or even worse removed or dynamically added). Also, how should this ViewModel be constructed and which technicalities to use here and in components to work as synergy??? On the web, I have found the various examples of the similar approach, but they are oversimplified (even for dummies) or over specific and do not provide valuable resource or general solution for this kind of implementation. If you have some serious examples it would be, also, very helpful. Note: My aim is to make interactions between many components on the same page simpler and more robust and elegant.

    Read the article

  • [EF + Oracle]Object Context

    - by JTorrecilla
    Prologue After EF episodes I and II, we are going to see the Object Context. What is Object Context? It is a class which manages the DB connection, and the different Entities of our model. When Visual Studio creates the EF model, like I explain previously, also generates a Class that extends ObjectContext. ObjectContext provides: - DB connection - Add, update and delete functions. - Object Sets of Entities. - State of Pending Changes. This class will give a function, for each Entity, like  Esta clase va a contar con una función, para cada entidad, del tipo “AddTo{ENTITY}({Entity_Type } value)”, which are going to add a Entity to the related ObjectSet. In addition, it has a property, for each Entity, like “ObjectSet<TEntity> Entity”, does will keep the related record set. It will be filled with the CreateObjectSet<TEntity> function of Base class (ObjectContext). What is an ObjectSet? It is a class that allows us to manage the Entity Set from a Type. It inherits from: · ObjectQuery<TEntity> · IObjectSet<TEntity> · IQueryAble<TEntity · IEnumerable<TEntity · IQueryAble · IEnumerable An ObjectSet is a class property that allows query, insert, delete and update records from a determinate Entity. In following chapters we will see how to query Entities. LazyLoadingEnabled A very important property of the Context is “LazyLoadingEnabled”. This Boolean property lets indicate if the data loading is lazy, in other words, the Object will not be created and query until not be needed. Finally In this post we have seen what the VS generated context is, some of the characteristics, and where to see Entity data. In next chapters we will see, CRUD operations, and how to query ObjectSets.

    Read the article

< Previous Page | 105 106 107 108 109 110 111 112 113 114 115 116  | Next Page >