If a client used a license to create a user, I need to update the Used column in the table. As I set ClientId column as the id column for this table in the mapping xml, I am getting TooManyRowsAffectedException. how to set a composite key at mapping level so that NHibernate can udpate based on ClientId and Type.
Something like: Update License SET Used=Used-1 WHERE ClientId='xxx' AND Type=1
I'm working on a RoleProvider in .NET, using Fluent NHibernate to map tables in an Oracle 9.2 database.
The problem is that the many-to-many table connecting users and roles uses a primary key generated from a sequence, as opposed to a composite key. I can't really change this, because I'm writing it to be implemented in a larger existing system.
Here is my UserMap:
public UserMap() { this.Table("USR");[code].....
Yet, this is giving me the error:
Type 'FluentNHibernate.Cfg.FluentConfigurationException' in assembly 'FluentNHibernate, Version=1.0.0.593, Culture=neutral, PublicKeyToken=8aa435e3cb308880' is not marked as serializable.
Is there a simple fix to allow this HasMayToMany to use my PersistentObjectMap extension? I'm thinking I may have to add a convention for this many-to-many relationship, but I don't know where to start with that, since I've just started using NHibernate and Fluent NHibernate only recently.
EDIT: I think I've found a possible solution here: http://marekblotny.blogspot.com/2009/02/fluent-nhbernate-and-collections.html
I'll try the above method of creating an entity and a class map for the linking table and post my findings.
EDIT 2: I created a linking entity as mentioned in the above blog post and downloaded the newest binaries (1.0.0.623). This helped me discover that the issue was with setting lazy load and trying to add roles to the user object in a completely new session.
I modified the code to move OpenSession to the BeginRequest of an HttpModule as described here. After doing this, I changed my data access code from wrapping the open session in a using statement, which closes the session when it is finished, to getting the current session and wrapping only the transaction in a using statement.
This seems to have resolved the bulk of my issue, but I am now getting an error that says "Could not insert collection" into the USR_ROLE table. And I'm wondering if the above code should work with a UserRoleMap described as:
public UserRoleMap() { this.Table("USR_ROLE"); [code]....
Hibernate's documentation for many-to-many relationship suggests creating an object to maintain a one-to-many/many-to-one, as in an ERD. I'm sure this would be much easier with conventional naming standards, but I have to stick with certain abbreviations and odd (and not always properly-implemented) conventions.
I have asp.net app where I am using gridview for data showing, editing and deleting. Now I want to delete or edit record from table and I need to pass 3 cols in DataBinder.Eval(Container.DataItem,"colName"). how i can do this?
EDITED
Basically when i need to update or delete record from asp.net app, I have to pass values of 3 columns (which are composite keys) to my UDF. Now How I can pass 3 different values to DataBinder.Eval() and reading them in GridView Rowcommand event.
I am learning custom controls and just finished my first one. The problem is that I am struggling to register it in my web config and have the compiler recognize it. Right now this results in a YSOD about the reference to the control.
note: exact error - Error Unknown server tag 'cc:LblTextBox'.
Web Config
//.. //.. <pages> <controls> <add tagPrefix="cc" namespace="Controls.Server"/> </controls> </pages> </system.web> The control code-behind namespace Controls.Server { public class LblTextBox : CompositeControl { //... } } mark-up <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ControlsMain.aspx.cs" Inherits="Pages_ControlsMain" Trace="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Controls Area</title> </head> <body> <form id="form1" runat="server"> <div> First attempt at a simple composite control <br /> <cc:LblTextBox ID="ccLblTbHybrid" runat="server" LabelText="Name:" /> </div> </form> </body>
I am developing asp.net MVC3 application and I have following entity
This entity has composite key (CreditRegistryId and Accoubnt No are primary keys). CreditRegistryId is a foreign key as well. How can I make composite key and foreign key. I am using DbContext API from EF 4.1. I am not using edmx ( ORM designer)
I have a table with composite primary key and this key includes two values referring to two other tables. Now I need to implement Edit feature for this Original Table but I wanted to have dropdown lists while editing pointing to look up tables(composite key values are primary keys for two lookup tables). for eg.
I am creating a composite control that has a textbox and uses a jquery plugin to add a watermark. Lets say I have a basic function that looks like this
$(function () {$('#MyTextBoxID').watermark('Enter your username');});
Can anyone suggest what I need to do to insert the above?
I'd like to have a div as a canvas, where users would choose images to show, out of a list. They will choose what background it would have, icons, and they will upload an image which will appear in this canvas too.I'm looking for solutions in PHP or ASP.NET.
in my implementation, I have an interface as: ICachingManager. I've got now one implementation. I also created a manager class as:
public class CachingManager { #region Members private ICachingManager service;
[Code]....
In case I had one implementation, then I can easily register the CachingManager class with Unity, automatically Unity resolves and injects the ICachingManager.
In case I had more than one implementation using named types, then how can I can make use of Unity? Do I need to make use of an Abstract Factory to decide on which named type to initialize?
Is it a good idea to make use of such a composite class or use directly implementations of the interface with Abstract Factory?
i have following entities as you see BudgetPost has a composite primary key which is a foreign keys to entities Category and Budget. My question is what is the best way to make CRUD? Is there any way to mapp the foreign keys? The simple insert should look like this:
I have a composite control that has a couple of private fields that reference values in the cache and these private fields are called during the constructor method. Since a string key is used to identify the value in the cache, I must have a way of storing that string key in such a way that it is available at the time the control is instantiated, and I have to be able to reference it on postbacks without it changing.
In addition, this key is generated the first time the control is loaded, but it should not be changed again after that first time.
How can I accomplish this?
I have already tried saving it to viewstate, but that doesn't work because viewstate is not yet available at the time the control is instantiated.
I have tried using a private field and then checking against Page.IsPostback in the constructor and if it isn't postback, I assign a value to the private field, but on subsequent postbacks it looses it's value, and I can't reassign it in the Page.IsPostBack again because it is an autogenerated GUID.
In our current ASP.Net Webforms application we have several composite/template server controls that only exist for a common look and feel. For example, we have a panel control that has a title, a place for buttons related to the contents of the panel, and of course the contents. How is this best accomplished in MVC? RenderPartial doesn't get done what I need here. Should I still be using the same controls, but just on a view page? These controls don't really do anything on postback, they are only there for a common look and feel.
More Info:
We have a control in Webforms that implements ICompositeControl. We have a few properties on this control like Panel (type Panel), Buttons (again type Panel which would hold buttons) and a property Title of type string. Visually it looks like
I am trying to make a simple composite control - just a label and textbox - but the postback isn't being picked up by the control.I haven't implemented IPostBackDataHandler as according to this its not necessary - the TextBox control should tie in automagically. A composite control that includes a TextBox need not worry about postbacks, as the embedded control will work it out with ASP.NET automatically.
I want to develop composite control where some of the work would be executed on client side. For that I am implementing IScriptControl.
ScriptReference points to a script file with client object.
Let's say I want it to have Listview(html select) control that onselect will run javascript function based on the selected value.
I can't just create the control dynamically is client js, because the control has UI on design mode so I must create the select control on server side (I create it in override void Render)
My problem how and where to assign the onselect event for the selection.
Update: Maybe I should add select's id as property to ScriptControlDescriptor, then in client control retrieve this id and attach the needed handler to the event?
I have got a composite control and i would like to dictate which attribute/property is assigned to the control first from the markup?example in the aspx file:
when the control gets created from the mark-up above, ViewType will be assigned first, Which is what I do not want, I would like RealBase to be assigned first under all circumstances. This control is to be users by other developers so I cannot just switch the order.