FluentNHibernate Convention/:Could Not Find A Setter For Property Children

Jul 25, 2010

Here's mt entity:
Csharp Code:
using System;using System.Collections.Generic;using System.Linq;namespace Venue.Domain{ using Venue.Infrastructure.Domain; public class Forum : Entity { private IList<Forum> children = new List<Forum>(); private IList<Moderator> moderators = new

[code]....

Here's my class map:

Csharp Code:
using FluentNHibernate.Mapping;namespace Venue.Persistence.Mapping{ using Venue.Domain; public class ForumMap : ClassMap<Forum> { public ForumMap() { Id(x => x.Id); Map(x => x.Sequence); Map(x => x.Title);

[code]....

And here's my convention:

Csharp Code:
using FluentNHibernate.Conventions;using FluentNHibernate.Conventions.Instances;namespace Venue.Persistence.Mapping.Conventions{ public class ReferenceConvention : IReferenceConvention { public void Apply(IManyToOneInstance instance) { instance.Column(instance.Property.Name + "Id"); } }}

I get the following message:Could not find a setter for property Children ...

View 2 Replies


Similar Messages:

MVC :: Model Not Validating Correctly In Controller. Optional Property With Required Children Fields

Oct 30, 2010

Basically I have RegisterModel2 that has a Person class. My requirement is that Phone Number and Address are not required for registration. But if they try to enter a Phone number of Address then it should validate it. Problem is that it is always stating that the child fields of Phone (area code, number) and child fields of Address (street1,city,etc) are required. Is there a way to annotate in the RegisterModel that a parent class is not Required but if any data in a child element is given then and only
then should the child elements be validated?

My Person EDM class has a nullable 0.1 -> 0.1 navigation property to Phone and Address.Here is the person class

[MetadataType(typeof(Person_Validation))]
public partial class Person
{
}

public class Person_Validation [code]....

The Person EntityObject has an optional/nullable Navigation Property to the Phone Object.


The Phone object has these annotations,[Code]....

I have RegisterModel defined as follows:
[Code]....

My View looks like this:
[Code]....

And here is my Controller Action it is posting to:
[Code]....

View 1 Replies

C# - How To Implement Validations In Setter Of Properties

Jun 8, 2010

I want to implement validations in setter of properties.

how I will do validations before setting value. but not getting what to do if passed value is not correct. Just not setting is not a acceptable solution as I want to return an appropriate message to user (in a label in web form). My example code is:

[code]....

A thought was to use return but it is not allowed.

Throwing error looks not good as generally we avoid thorwing custom errors.

View 4 Replies

FluentNHibernate ClassMaps / How To Code Relationships Period

Apr 21, 2010

Just a quick question for those more familiar with FluentNHibernate. I've read the quick start things, and the docs on their site, but am still a tad off. Are the following maps correct, in terms of the HasOne / HasMany relationships? If not, correct them, and give me reasons, so I better understand.

C sharp Code:

[code]....

These will eventually go into a convention file, but for now, I just need to know how to code relationships period.

View 4 Replies

Practical Application Of Convention Vs Configuration

Apr 18, 2010

but here's a case in point that I'd like to share and get input on. Below are two entities, coded like normal.

Csharp Code:
using System.Collections.Generic;using SharpArch.Core.DomainModel;namespace Venue.Core{public class Category : Entity{private virtual IList<Forum> forums = new List<Forum>();public virtual int Sequence { get; set; }public virtual string Title { get; protected set; }public virtual string Description { get; set; }public virtual bool Enabled { get; set; }public virtual bool Visible { get; set; }public virtual IEnumerable<Forum> Forums { get { return forums; } }public void AddForum(Forum entity) { forums.Add(entity); }public void RemoveForum(Forum entity) { forums.Remove(entity); }public Category(string title){Title = title;}}}
[code]...

View 10 Replies

Efficiency - NamingContainer Naming Convention?

Mar 1, 2011

I'm working on a project in which the client has required a lot of things to happen on a single page, and this has resulted in a rather large blob of HTML being rendered out to the client browser.

The main issue is with input tags (where runat="server" attribute is set), these tend to cause a drastic increase in markup size due to validation, updatepanel triggers, viewstate, and the control markup itself. I've done what I can to reduce the amount of triggers I'm using, I'm compressing the viewstate (to something like 8% of the original viewstate size), I've gotten rid of a lot of ASP.NET Validators and rolled my own, and and I've been using ClientIdMode to reduce the length of the ID attributes of many asp.net elements. All of these combined significantly reduces the amount of HTML being sent to the client, (for example going from 2 megabytes for a request down to 500-600 kb - these are HUGE pages, mind you).

[Code]....

View 2 Replies

Changing The CreatedBy Convention In Subsonic (3x)?

Mar 7, 2011

I'm working against a database that wasn't designed by me and in all the tables there is a CreatedBy field that is an int. Now when I generate against this db i get all kinds of errors because subsonic is expecting that field to be a varchar.I don't particularly want to go and rename the field in all of these tables so I was hoping there was a way to "alter" or change the internal convention (without getting into the source) in subsonic.Has anyone been able/done this in subsonic 3.0.4??EDIT: I'm using the active record model in subsonic 3

View 1 Replies

Loop Through Controls That Follow A Naming Convention?

Jan 12, 2011

I have ten textboxes (txtCO1, txtCO2... txtCO10).I need to set them all to the same text (blank). How can I use a for loop that just changes the number after txtCO, isntead of explicitly setting each text box's text property to ""?

View 6 Replies

VS 2008 - Naming Convention For Files And Folders

Oct 24, 2014

Is there a recommended naming convention for files and folders in ASP.NET? So far, I've found this thread on the native ASP.NET forum. But it doesn't sound very useful. Some people say "meh, naming convention is not that important", others reply "no, naming conventions are important" but don't say what the recommended convention for ASP.NET actually is.I can use standard VB notation for variables and method names inside the files.

View 2 Replies

Gridview - What Property Exists To Find Out If The Grid Renders Or Not

Nov 17, 2010

When there is no DataSource assigned to my grid it doesn't render which is great!

When the datasource is empty it doesn't render - also great :-)

I am implementing some custom navigation so i want to know if there is a property that tells me if the dataview is rendered? If it is rendered i can show my custom bits otherwise i don't.

View 2 Replies

Directive Convention For Declaring Client-Side Includes?

Mar 10, 2011

I am loading .aspx and .ascx files as StreamReader.

I want each file to register it's javascript and stylesheet dependencies in some declaration like a <%@ ClientDependency path="~/Scripts/jquery-1.4.1.min.js" %>.

Is there an existing convention for doing such a thing? I don't need an implementation, but I don't want to create a new syntax if there is already a way to do it.

Also, what are the guidelines for custom <%@ blocks in ASP.NET?

View 3 Replies

Naming A Value Combined "getter/setter" Method (WebForms & Binding)

Apr 29, 2010

I'm currently working on. I don't have a compsci degree so I don't know what to call this.I have a method called TryToGetSetValue(Direction direction, object value, object valueOnFail)

public enum Direction
{
ModelToForm,
FormToModel

View 2 Replies

Web Forms :: Loop Through Calendar Cells To Find Checked Property Of Checkbox

Aug 10, 2010

I have a calendar control that has a checkbox control added to each cell on dayrender. A user will check the dates that they want to add an event for and click a button that will display the modaldialog box where the user will enter the event for the selected dates. I'm having trouble looping through the calendar dates to get the checkbox contol's checked property.

View 2 Replies

Forms Data Controls :: Find Control Name / Change Property In DetailsView

Jan 4, 2010

I can't seem to reference a control properly, so that I could then change its properties. I have 3 fckeditor controls specified in edittemplate fields, but i only want to diplay them all if the querystring equals 1. so i created in aspx.cs file: {

View 4 Replies

Web Forms :: Anchor / Not Able To Find Visible Property In Codebehind Since It Is A HTML Control?

Oct 1, 2010

I have a Sidemenu item in my ASP.NET application like below. There are two types of users in my application (Associates, Managers).When ever Associate Login then I have to disable Manager link. I am not able find visible property in codebehind since it is a HTML control. So need your support how to handle this

<ul>
<li><a href="Associate.aspx?val=Tests&index=0" id="lnkAssociates">Associate</a></li>
<li><a href="Manager.aspx id="lnkManager">Manager</a></li>
</ul>

View 2 Replies

FluentNHibernate Error - "Invalid Object Name"

May 16, 2010

I'm attempting to do the most simple of mappings with FluentNHibernate & Sql2005. Basically, I have a database table called "sv_Categories". I'd like to add a category, setting the ID automatically, and adding the userid and title supplied.

Database table layout:

CategoryID -- int -- not-null, primary key, auto-incrementing
UserID -- uniqueidentifier -- not null
Title -- varchar(50) -- not null

Simple.

My SessionFactory code (which works, as far as I can tell):
_SessionFactory = Fluently.Configure().Database(
MsSqlConfiguration.MsSql2005
.ConnectionString(c => c.FromConnectionStringWithKey("SVTest")))
.Mappings(x => x.FluentMappings.AddFromAssemblyOf<CategoryMap>())
.BuildSessionFactory();

My ClassMap code:

public class CategoryMap : ClassMap<Category>
{
public CategoryMap()
{
Id(x => x.ID).Column("CategoryID").Unique();
Map(x => x.Title).Column("Title").Not.Nullable();
Map(x => x.UserID).Column("UserID").Not.Nullable();
}
}

My Class code:

public class Category
{
public virtual int ID { get; private set; }
public virtual string Title { get; set; }
public virtual Guid UserID { get; set; }.......

View 1 Replies

Custom Server Controls :: Find The Data Values Of The Fields Specified In The DataNavigateUrlFields Property?

Jan 27, 2010

I have created a class which inherits the HyperLinkField. I need to find the data values of the fields specified in the DataNavigateUrlFields property. I have not been able to figure out how to do this.

View 1 Replies

MVC :: How To Add Parent / Children

Apr 23, 2010

Can someone point me in the right direction for adding a parent then sending the user to a new page to add children one by one?

My example: Exam (Parent) to ExamQuestion (Children).

View 5 Replies

Get First Level Of Children By LINQ?

Jun 22, 2010

I have such XMl

<root>
<list>
<list>
<topic></topic>
<topic></topic>
</list>
<topic></topic>
<topic></topic>
</list>
<topic></topic>
<topic></topic>
<topic></topic>
</root>

I need to get the first level of children:

<list></list>
<topic></topic>
<topic></topic>
<topic></topic>

I try to do like this

var list = x.Descendants().Where(e => e.Name == "list" || e.Name == "topic");

View 1 Replies

AJAX :: Trying To Use Parent Two Children Combination?

May 26, 2010

I have very strange Cascading Dropdownlist behavior. When I use one parent, one child - everything is fine, but one parent two children combination does not work well. Sometimes both children show right data; sometime first is fine and second is grey, or first is fine and second [Method error 500], or second is fine and first is wrong and so on.

Did somebody try to use parent two children combination?

View 4 Replies

C# - How To Read Parent And Children Data From SQL

Mar 14, 2011

I have two tables in SQL. The first defines the parent, and has a primary key column called ParentId. I also have a child table that has a primary key, and a foreign key as 'ParentId'. So the two tables form a one parent - to many children relationship.

The question is what is the most efficient way to pull the parent + child data C# code? The data has to be read into the following objects:

[Code]....

and use LINQ to merge all parents with children. This approach makes 2 trips to the db.

The third and final (also most inefficient) approach is to grab all parents, and while constructing each parent object, make a trip to the DB to grab all its children. This approach takes n+1 connections: 1 for all parents and n number of trips to get all children for each parent.

Any advise on how to do this easier? Granted i can't get away from using stored procedures, and I can't use LINQ2SQL or EF. Would you prefer Data Tables vs DataReaders and if so how to use either with approach 1 or 2?

View 4 Replies

C# - Add Children Controls Within A ServerControl Tags?

Nov 10, 2010

I'm working on a Navigation Menu. I've created below ServerControl and it works, but I want to allow users adding some standard ASP.NET controls within my ServerControl Tags like label, image and so on.

<MdsMenu:ServerControlMenu ID="ServerControlMenu1" runat="server">
<MdsMenu:animation AnimationSpeed="Normal" AnimationType="Opacity_Height" Delay="1000" DropShadow="true" />
<!-- HERE HAS TO HAVE SOME STANDARD ASP.NET CONTROLS -->
<!-- e.g <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> -->
</MdsMenu:MenuItem>
</MdsMenu:ServerControlMenu>

My problem is here that how I can get Child Controls within <MdsMenu:MenuItem> and show them like as they are in the output. P.S: I overwrite RenderContents method

protected override void RenderContents(HtmlTextWriter output)
{
output.Write(OutPutStringBuilder.ToString());
}

View 2 Replies

C# - Binding An Xml Node's Children To DropDownList

Nov 30, 2010

I'm trying to bind the contents of a node of XML to a Drop Down List without much success. Initially, the whole XML document is bound to a repeater - this works perfectly, but now I need to display a drop down list based on the children in the "" node, but I get Data at the root level is invalid. Line 1, position 1 error message on the DataBind() method on the dropDownList. The code snippet I'm using is:

IXPathNavigable x = (IXPathNavigable)e.Item.DataItem;
XPathNavigator questionNode = x.CreateNavigator();
string question = questionNode.SelectSingleNode("questionText").ToString();
//string title = xePage.SelectSingleNode("q").InnerText;
Literal questionText = (Literal)e.Item.FindControl("litQuestionText");
questionText.Text = question;
Panel iconDiv = (Panel)e.Item.FindControl("divIcon");
iconDiv.CssClass = string.Format("icon {0}", questionNode.SelectSingleNode("iconType"));
Panel sliderPanel = (Panel)e.Item.FindControl("pnlSlider");
DropDownList answerDropDown = (DropDownList)e.Item.FindControl("ddlAnswer");
TextBox answerText = (TextBox)e.Item.FindControl("txtAnswer");
switch (questionNode.SelectSingleNode("answerType").ToString())
{
case "d":
sliderPanel.Visible = false;
answerText.Visible = false;
answerDropDown.Visible = true;
XmlDataSource answersList = new XmlDataSource();
answersList.Data = questionNode.Select("answers").ToString();
Response.Write(answersList.ToString());
//XPathNodeIterator answers = questionNode.Select("answers");
//answers.AsQueryable();
answersList.ID = questionNode.SelectSingleNode("questionId").ToString();
answerDropDown.DataSource = answersList;
answerDropDown.DataTextField = "@display";....................................

View 1 Replies

Web Forms :: If Label Property Is Set To Visible = "False", Then Can It Be Find In View Source Of Browser ?

Feb 18, 2011

I have a label1 in my aspx page, which property is set to visible = "False".

In the view source of the browser i cant able to find that label1.But using some other third party tool like "Burp Suite" etc ...

Can those label1 value could be seen or not using tools like "Burp Suite" etc ?

View 3 Replies

MVC :: MVC-3 -- How To Efficiently Connect Children To Parent In The View

Feb 13, 2011

I have a parent/child relationship that I'm currently pulling via the EF .include() method and displaying via two foreach loops in my view -- the first foreach loop is for the parents and the second is nested inside each parent and is for the children of that parent.

This has worked fine, but now I need to display information about each child that is not contained in my main child table. The table that contains this extra information only has a relationship to the main child table and thus there is no association between this table and the main parent table --- i.e. the .include() method can't pick this up. I've looked, found nothing and thus assume that I can't have two .include methods chained together. (even if I could, would this be efficient?)

I know I can perform a simple join and pull all of the child information with the parent records, but that would create issues with my paging because I want the page size determined by the number of parent records displayed. For some parents, there are only two children; other parents may have 10 children. So a simple join would create records where the parent information is duplicated and would throw off the paging.

Ideally I'd like to pull the parent information and pull the children information and connect the two when the view is populated, but I don't have a clue on how to do this efficiently (if that's even possible).

View 8 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved