Hi All, Im just wondering how you go about creating dynamic properties on entities that generated from a database generated model.
For example I have a UserInformation table. In that table it has basic information on the user (well derr) like user name, address details etc etc. I want to add a readonly property that concatenates the use...
Background
We have several projects / applications running off the same model. They all have their own unique entities / tables, but also share 1 specific, common entity / table.
I.e. Entities required by application A, will never be required by application B, except for the common table, and vice versa. Now the common table has relatio...
I am working on a VB.NET project which is using ASP.NET MVC 2. I am taking advantage of the ability to add validation and other attributes to the metadata in my model.
For example, I have added attributes such as <DisplayName("Full Name")> to the properties in my model and am rendering these using the Html.LabelFor () extension method....
I'm using MVC 2.0 in an ASP.NET application using NHibernate.
I have a working View, Controller and data access layer using NHibernate that is able to display and save an entity with a relationship to another mapped entity:
Person -- > Location
It's using the HTML helper HTML.DropDownListFor() to display a list of all Locations. The u...
I'm just starting to sketch up the base of a web-based system, and I would like the admin to have the possibility to limit access either by Controller or by Model. My problem is, I can't decide which one (or both?) of them I should go with. Any ideas? Pros/Cons?
First I was leaning towards doing it in the Controllers, seeing as they "co...
I am having a strange caching problem and I believe it might be related to the fact that I am using a Entity Data Model as my data source.
The problem is that I can update the database directly and it doesn't reflect on the actual site until I republish the project. The data does display properly when viewing the project locally.
The o...
Hello,
[Sorry but work is proprietary so I cannot give details of objects]
I am working on a Java application with a colleague. I am doing the client side and he is writing the server code.
The application displays a table of X objects. The columns of the table show some of X's attributes. In addition we have a column that shows a cou...
Hi,
I get data from Model (an array with data) and I need to display with a specific format. I need to iterate over the array, format the data and then display it. Where should I format data to display? In Model, Controller or View?
Thank you.
...
I would like to use Automapper to map my model objects to database objects. Let say database object is over 30 fields and I want map 10 out of 20 properties from my model. To make it more complex I need to map different properties when I update record than when I insert new record to database.
The solution I'm using is to create 2 gener...
Hello;
today I examinted WAP from codeplex a bit and saw this:
BookListView.xaml:
<ListView ItemsSource="{Binding Books}" SelectedItem="{Binding SelectedBook}"
SelectionChanged="ListViewSelectionChanged">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding=...
Hi,
In a model of my ASP.NET MVC application I would like validate a textbox as required only if a specific checkbox is checked.
Something like
public bool retired {get, set};
[RequiredIf("retired",true)]
public string retirementAge {get, set};
How can I do that?
Thank you.
...
Greetings,
In VS2010, I cannot find the template ADO.NET Entity Data Model from the Data section.
I was doing:
1. create a silverlight(version 4th) project with a WebSite
2. right click the web project, Add -> New Item -> Data Section(actually, I tried every one)
But i cannot find it!! It's weird!
Then,
1. I tried to reset my VS templ...
Hello,
I have this method (50+ lines) in one of my models, I prefer not having to scroll so much and not losing my cursor sometimes because of its taking up so much space. I wonder if I can put it away in a separate file and sort of include it in the model instead.
Thanks!
...
Hello,
I am using this to validate a form field
$valid = $this->isUnique(array($fieldName1 => $data, $fieldName2 => 'Y'));
executing this the query is coming like this:
SELECT COUNT(*) AS count FROM users AS User WHERE ((User.emailid = ('[email protected]')) OR (User.isdeleted = 'Y'))
I just need to change that "OR" to "AND".
Pl...
Hi,
I have a one-to-one relation between an Account and a User table, I'm trying to do all the pre-processing in the beforeSave of the account model, but it seems like i can only change the values of $this->data['Account'][...] and not $this->data['User'][...], why is so?
function beforeSave() {
// Check if this is a create or updat...
This is a method that used to be in the controller and I think it makes more sense to make it a method to the Contact model:
def colleagues
company = Company.find(self.company_id)
contacts = company.contacts.collect(&:full_name)
contacts.each do |contact|
colleagues = contacts.reject{ |c| c==contact }
end
...
Any time i do a class-diagramm with the Xcode-internal solution, any inheritance-link is missing. But anytime another.. it is not even the same link, that is missing.
so, has anyone an idea, how to edit the files manually ?
...
How do I come to know whether a create or any other action has been called from inside a model. Basically I am doing database logging and want to track whether a create or other actions are being performed.
For doing the logging part I am using the concept of ActiveRecord::Observer. But there I am not able to find out whether the user i...
I'm building a first MVC app in ASP.NET and I'm using link2SQL model to work with data.
All tutorials on the microsoft site let you write LINQ code in the controller to get data and pass it to the view, like this:
Function Index() As ActionResult
Dim datacontext As New ErrorVaultDataContext
Dim questions = From q In da...
Hi,
Is there a way to write a custom validator that will perform different validations according to field values?
For example
class myModel{
A a;
B b;
String prop
static belongsTo:[m:myModel]
constraints{
prop(validator:{
val,obj->
if (obj.a== null){
unique:[b,prop]
...