Search Results

Search found 5369 results on 215 pages for 'entity razer'.

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

  • entity framework and dirty reads

    - by bryanjonker
    I have Entity Framework (.NET 4.0) going against SQL Server 2008. The database is (theoretically) getting updated during business hours -- delete, then insert, all through a transaction. Practically, it's not going to happen that often. But, I need to make sure I can always read data in the database. The application I'm writing will never do any types of writes to the data -- read-only. If I do a dirty read, I can always access the data; the worst that happens is I get old data (which is acceptable). However, can I tell Entity Framework to always use dirty reads? Are there performance or data integrity issues I need to worry about if I set up EF this way? Or should I take a step back and see about rewriting the process that's doing the delete/insert process?

    Read the article

  • ASP.NET MVC CRUD Validation

    - by Ricardo Peres
    One thing I didn’t refer on my previous post on ASP.NET MVC CRUD with AJAX was how to retrieve model validation information into the client. We want to send any model validation errors to the client in the JSON object that contains the ProductId, RowVersion and Success properties, specifically, if there are any errors, we will add an extra Errors collection property. Here’s how: 1: [HttpPost] 2: [AjaxOnly] 3: [Authorize] 4: public JsonResult Edit(Product product) 5: { 6: if (this.ModelState.IsValid == true) 7: { 8: using (ProductContext ctx = new ProductContext()) 9: { 10: Boolean success = false; 11:  12: ctx.Entry(product).State = (product.ProductId == 0) ? EntityState.Added : EntityState.Modified; 13:  14: try 15: { 16: success = (ctx.SaveChanges() == 1); 17: } 18: catch (DbUpdateConcurrencyException) 19: { 20: ctx.Entry(product).Reload(); 21: } 22:  23: return (this.Json(new { Success = success, ProductId = product.ProductId, RowVersion = Convert.ToBase64String(product.RowVersion) })); 24: } 25: } 26: else 27: { 28: Dictionary<String, String> errors = new Dictionary<String, String>(); 29:  30: foreach (KeyValuePair<String, ModelState> keyValue in this.ModelState) 31: { 32: String key = keyValue.Key; 33: ModelState modelState = keyValue.Value; 34:  35: foreach (ModelError error in modelState.Errors) 36: { 37: errors[key] = error.ErrorMessage; 38: } 39: } 40:  41: return (this.Json(new { Success = false, ProductId = 0, RowVersion = String.Empty, Errors = errors })); 42: } 43: } As for the view, we need to change slightly the onSuccess JavaScript handler on the Single view: 1: function onSuccess(ctx) 2: { 3: if (typeof (ctx.Success) != 'undefined') 4: { 5: $('input#ProductId').val(ctx.ProductId); 6: $('input#RowVersion').val(ctx.RowVersion); 7:  8: if (ctx.Success == false) 9: { 10: var errors = ''; 11:  12: if (typeof (ctx.Errors) != 'undefined') 13: { 14: for (var key in ctx.Errors) 15: { 16: errors += key + ': ' + ctx.Errors[key] + '\n'; 17: } 18:  19: window.alert('An error occurred while updating the entity: the model contained the following errors.\n\n' + errors); 20: } 21: else 22: { 23: window.alert('An error occurred while updating the entity: it may have been modified by third parties. Please try again.'); 24: } 25: } 26: else 27: { 28: window.alert('Saved successfully'); 29: } 30: } 31: else 32: { 33: if (window.confirm('Not logged in. Login now?') == true) 34: { 35: document.location.href = '<% 1: : FormsAuthentication.LoginUrl %>?ReturnURL=' + document.location.pathname; 36: } 37: } 38: } The logic is as this: If the Edit action method is called for a new entity (the ProductId is 0) and it is valid, the entity is saved, and the JSON results contains a Success flag set to true, a ProductId property with the database-generated primary key and a RowVersion with the server-generated ROWVERSION; If the model is not valid, the JSON result will contain the Success flag set to false and the Errors collection populated with all the model validation errors; If the entity already exists in the database (ProductId not 0) and the model is valid, but the stored ROWVERSION is different that the one on the view, the result will set the Success property to false and will return the current (as loaded from the database) value of the ROWVERSION on the RowVersion property. On a future post I will talk about the possibilities that exist for performing model validation, stay tuned!

    Read the article

  • Entity Component System, weapon

    - by Heorhiy
    I'm new to game programming and currently trying to understand Entity Component System design by implementing simple 2d game. By ECS I mean design, described here for example In my game I have different kind of weapons: automatic, gun, grenade, etc... Each type of weapon has it's own affect area (gun shots along the straight line and grenade explodes and covers some spherical area) , damage impact, visual effect and bullet amount, delay between shots. So I don't completely understand how to implement weapons. Should weapon be an Entity or it should be a component? And how the player should pick up a weapon, switch between different types of weapons and etc.

    Read the article

  • Making more complicated systems(entity-component-system model question)

    - by winch
    I'm using a model where entities are collections of components and components are just data. All the logic goes into systems which operate on components. Making basic systems(for Rendering and handling collision) was easy. But how do I do more compilcated systems? For example, in a CollisionSystem I can check if entity A collides with entity B. I have this code in CollisionSystem for checking if B damages A: if(collides(a, b)) { HealthComponent* hc = a->get<HealthComponent(); hc.reduceHealth(b->get<DamageComponent>()->getDamage()); But I feel that this code shouldn't belong to Collision system. Where should code like this be and which additional systems should I create to make this code generic?

    Read the article

  • Rendering order in an Entity System

    - by Daedalus
    Say I use a basic ES approach, and also inside Systems I hold lists of all entities that Systems are required to process. How do I maintain this list of entities in desired rendering order, i.e. for a dumb 2D RenderingSystem? I saw this discussion, and what they suggest is to do something like Z ordering - what I would probably do is just to store a "layer" int in DrawableComponent and then, inside RenderingSystem, just sort entities by mentioned "layer" whenever the entity list for RenderingSystem changes. They also say we could just delete and recreate the entity whenever we want it on the top, but it seems too inflexible to me. How is this problem usually solved?

    Read the article

  • Entity framework architecture

    - by user1741807
    I want to make a entity framework application in Winforms C#. I'm new to entity framework, and don't know how to make the architecture. I want to have the model in a class library, and a GUI layer, and maybe a controller layer. I'm used to that architecture, but don't know have to handle the objects in other layers than the model. Have do I manage objects in the gui layer, when I can't have a reference to the model? I'm used to have some kind of dto, but what's the best way?

    Read the article

  • Adding existing entity to navigation property of a different entity

    - by Shay Friedman
    I'm using EF4 and I'm running into a problem when I try to do something that looks quite trivial to me. I have two entities, let's call them A and B. These entities have a many-to-many association between them with a navigation property on A that contains a list of related B entities. What I want to do is to add existing B entities to a new A entity. When I try to do that, I get an exception: AcceptChanges cannot continue because the object's key values conflict with another object in the ObjectStateManager. Make sure that the key values are unique before calling AcceptChanges. Has anyone run into such a problem?

    Read the article

  • Deleting entity with child relationships using .Net Entity Framework problem

    - by Am
    My God, EF is so frustrating. I can't seem to be able to get my head around what I need to do so I can delete an object. I seem to be able to remove the object but not the related child objects. Can anyone tell me what is the rule of thumb when you want to delete all related child objects of a given object? I've tried loading all related objects like this: if (!object.childobjects.IsLoaded) object.childobjects.Load(); but once I do the following I get errors related to the relationships: modelcontext.DeleteObject(object); modelcontext.SaveChanges(); Why can't I just load the object using modelcontext.GetObjectByKey and remove it along with its child objects? My other question is can I delete an object using Entity command like so? DELETE e from objectset as e where e.id = 12 I've tried few variations and all of them throw exceptions.

    Read the article

  • RIA Services - Two entity models share an entity name

    - by Alex
    I have two entity models hooked up to two different databases. However, the two databases both have a table named 'brand', for example. As such, there is a naming conflict in my models. Now, I've been able to add a namespace to each model, via Custom Tool Namespace in the model's properties, but the generated code in my Silverlight project will try to use both namespaces, and come up with this, Imports MyProject.ModelA Imports MyProject.ModelB Public ReadOnly Property brands() As EntitySet(Of brand) Get Return MyBase.EntityContainer.GetEntitySet(Of brand) End Get End Property giving me this exception: 'Error 1 'brand' is ambiguous, imported from the namespaces or types 'MyProject.ModelA,MyProject.ModelB'. Has anyone had experience with naming conflicts like this using RIA services? How did you solve it?

    Read the article

  • Entity Framework 4.1 auto generate with DbContext when creating ADO.NET Entity Data Model

    - by smudgedlens
    I would like to work with DbContext instead of ObjectContext. I updated EF so now I have the DbContext, but I want to generate my strongly-typed context based on the DbContext and not the ObjectContext. When I add new ADO.NET Entity Data Model, it is still based on the ObjectContext. Is it not possible to have it base off of DbContext in Visual Studio 2010 with EF 4.1? UPDATE: Okay, I followed the directions in this link and was able to generate the DbContext template objects. However, now it is saying there is ambiguity between the template entities and the entities in my .edmx file. How do I resovle this? Do I blow away the ones in the .edmx file?

    Read the article

  • Role of an entity state in a component based system?

    - by Paul
    Component-based entity systems are all the rage these days; everyone seems to agree they are the way to go, but no one really has a definitive implementation of such a system. I was wondering, what role do entity states (walking-left, standing, jumping, etc) have in a CBS? Do they act like controllers (i.e. they handle events and change the entity's attributes based on those events)? What about cases where a state would, for example, require that the entity enters no-clip mode? Should, that state, when it enters, maybe set the CollisionComponent of the entity to a null pointer or something? (Then, on exit, the state should restore the entity's CollisionComponent to its previous state.) Also, I guess it's the current state's job to change the entity's state to something else, right?

    Read the article

  • Entity Framework - Foreign key constraints not added for inherited entity

    - by Tri Q
    Hello, It appears to me that a strange phenomenon is occurring with inherited entities (TPT) in EF4. I have three entities. 1. Asset 2. Property 3. Activity Property is a derived-type of Asset. Property has many activities (many-to-many) When modeling this in my EDMX, everything seems fine until I try to insert a new Property into the database. If the property does not contain any Activity, it works, but all hell breaks loose when I add some new activities to the new Property. As it turns out after 2 days of crawling the web and fiddling around, I noticed that in the EF store (SSDL) some of the constraints between entities were not picked up during the update process. Property_Activity table which links properties and activities show only one constraint FK_Property_Activity_Activity but FK_Property_Activity_Property was missing. I knew this is an Entity Framework anomoly because when I switched the relationship in the database to: Asset <-- Asset_Activity <-- Activity After an update, all foreign key constraints are picked up and the save is successful, with or without activities in the new property. Is this intended or a bug in EF? How do I get around this problem? Should I abandon inheritance altogether?

    Read the article

  • Entity Framework and differences between Contains between SQL and objects using ToLower

    - by John Ptacek
    I have run into an "issue" I am not quite sure I understand with Entity Framework. I am using Entity Framework 4 and have tried to utilize a TDD approach. As a result, I recently implemented a search feature using a Repository pattern. For my test project, I am implementing my repository interface and have a set of "fake" object data I am using for test purposes. I ran into an issue trying to get the Contains clause to work for case invariant search. My code snippet for both my test and the repository class used against the database is as follows: if (!string.IsNullOrEmpty(Description)) { items = items.Where(r => r.Description.ToLower().Contains(Description.ToLower())); } However, when I ran my test cases the results where not populated if my case did not match the underlying data. I tried looking into what I thought was an issue for a while. To clear my mind, I went for a run and wondered if the same code with EF would work against a SQL back end database, since SQL will explicitly support the like command and it executed as I expected, using the same logic. I understand why EF against the database back end supports the Contains clause. However, I was surprised that my unit tests did not. Any ideas why other than the SQL server support of the like clause when I use objects I populate in a collection instead of against the database server? Thanks! John

    Read the article

  • Seeding many to many tables with Entity Framework

    - by Doozer1979
    I have a meeting entity and a users entity which have a many to many relationship. I'm using Autopoco to create seed data for the Users and meetings How do i seed the UserMeetings linking table that is created by EntityFramework with seed data? The linking table has two fields in it; User_Id, and Meeting_ID. I'm looping through the list of users that autopoco creates and attaching a random number of meetings Here's what i've got so far. foreach (var user in userList) { var rand = new Random(); var amountOfMeetingsToAdd = rand.Next(1, 300); for (var i = 0; i <= amountOfMeetingsToAdd; i++) { var randomMeeting = rand.Next(1, MeetingRecords); //Error occurs on This line user.Meetings.Add(_meetings[randomMeeting]); } } I got an 'Object reference not set to an instance of an object.' even though the meeting record that i'm trying to attach does exist. For info all this is happening prior to me saving the context to the DB.

    Read the article

  • Entity Framework one-to-one relationship mapping flattened in code

    - by Josh Close
    I have a table structure like so. Address: AddressId int not null primary key identity ...more columns AddressContinental: AddressId int not null primary key identity foreign key to pk of Address County State AddressInternational: AddressId int not null primary key identity foreign key to pk of Address ProvinceRegion I don't have control over schema, this is just the way it is. Now, what I want to do is have a single Address object. public class Address { public int AddressId { get; set; } public County County { get; set; } public State State { get; set } public ProvinceRegion { get; set; } } I want to have EF pull it out of the database as a single entity. When saving, I want to save the single entity and have EF know to split it into the three tables. How would I map this in EF 4.1 Code First? I've been searching around and haven't found anything that meets my case yet. UPDATE An address record will have a record in Address and one in either AddressContinental or AddressInternational, but not both.

    Read the article

  • Extra buttons on Razer Anansi on Ubuntu 13.04

    - by jjpe
    I own a Razer Anansi keyboard and recently installed 13.04 after running 12.04 for over a year. On 12.04 I used xmodmap to map the thumb and macro keys to do useful stuff for me. This solution is based on keycodes which are triggered when a key is recognized. The problem is that on 13.04 this does not work for all keys anymore. The thumb keys T2, T3 and T4 (i.e. the middle 3 ones on the top of the 2 rows) in particular don't generate keycodes anymore while the rest still does. Now this is not completely surprising: pressing the affected keys in Unity generates notifications for what looks like Unity touchpad notifications. How can I shut that touchpad-subsystem up once and for all and give my keyboard keys back to my keyboard? Ideally I'd like to be able to use my .Xmodmap file again in 13.04 (and beyond) as that seems to me the most simple solution, but working alternatives are also welcome.

    Read the article

  • Using macro keys with razer blackwidow ultimate 2013

    - by user119020
    I recently bought a Razer blackwidow ultimate 2013 keyboard. The keyboad contains 5 macro keys and according to the manual, they can be quickly set using the key combination fn+f9. However, this doesn't work; it won't record any macros. All the other function buttons on the keyboard work fine (e.g. volume up, volume down, stand-by) Does anyone know how I can enable those keys? Maybe an extra package. I am using 64 bit ubuntu 12.04 Thanks in advance :)

    Read the article

  • Entity Framework naming conventions for many-to-many link tables

    - by TimothyP
    Hi, We are designing a SQL Server database with link tables for many-to-many relations. The question is are there any best practices for naming these kinds of tables for use with the entity framework? Let's say there's a table Customer and Address Then there is a link table between them, what do we call it? CustomerAddress ? Or something else? Thnx

    Read the article

  • SQL Server backward compatibility in Entity Framework?

    - by shake
    Is there any backward compatibility in the entity framework between SQL Server 2008 and 2005? It seems the framework forces you to use the same provider for all the .edmx files in a solution. If you use the 2008 provider, data types like DateTime2 and functions like SysDateTime that are emitted by the framework to the underlying SQL query make it useless to use them against a SQL 2005 Server. Any way around this?

    Read the article

  • How to create entities in one Entity group ?

    - by Gopi
    I am building an app based on google app engine (Java) using JDO for persistence. Can someone give me an example or a point me to some code which shows persisting of multiple entities (of same type) using javax.jdo.PersistenceManager.makePersistentAll() within a transaction. Basically I need to understand how to put multiple entites in one Entity Group so that they can be saved using makePersistentAll() inside transaction.

    Read the article

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