Search Results

Search found 9 results on 1 pages for 'akk'.

Page 1/1 | 1 

  • How to access the backing field of an inherited class using fluent nhibernate

    - by Akk
    How do i set the Access Strategy in the mapping class to point to the inherited _photos field? public class Content { private IList<Photo> _photos; public Content() { _photos = new List<Photo>(); } public virtual IEnumerable<Photo> Photos { get { return _photos; } } public virtual void AddPhoto() {...} } public class Article : Content { public string Body {get; set;} } I am currently using thw following to try and locate the backing field but an exception is thrown as it cannot be found. public class ArticleMap : ClassMap<Article> { HasManyToMany(x => x.Photos) .Access.CamelCaseField(Prefix.Underscore) //_photos //... } i tried moving the backing field _photos directly into the class and the access works. So how can i access the backing field of an inherited class?

    Read the article

  • Why does the entity framework need an ICollection for lazy loading?

    - by Akk
    I want to write a rich domain class such as public class Product { public IEnumerable<Photo> Photos {get; private set;} public void AddPhoto(){...} public void RemovePhoto(){...} } But the entity framework (V4 code first approach) requires an ICollection type for lazy loading! The above code no longer works as designed since clients can bypass the AddPhoto / RemovePhoto method and directly call the add method on ICollection. This is not good. public class Product { public ICollection<Photo> Photos {get; private set;} //Bad public void AddPhoto(){...} public void RemovePhoto(){...} } It's getting really frustrating trying to implement DDD with the EF4. Why did they choose the ICollection for lazy loading? How can i overcome this? Does NHibernate offer me a better DDD experience?

    Read the article

  • How to structure a Visual Studio project for the data access layer

    - by Akk
    I currently have a project that uses various DB access technologies mainly for showcasing or for demos. Currently we have: Namespace App.Data (App.Data.dll) Folder NHibernate Folder EntityFramework Folder LinqToSql The above structure is ok as we only use Sql Server as the DB. But going forward we will be including Oracle, MySql etc. So what would be a better structure with this in mind? I thought about: Namespace App.Data.SqlServer (App.Data.SqlServer.dll) Folder NHibernate Folder EntityFramework Folder LinqToSql Or would it just be better to have separate assemblies for each database and access technology?: Namespace App.Data.SqlServer.NHibernate (App.Data.SqlServer.NHibernate.dll) Namespace App.Data.SqlServer.EntityFramework(App.Data.SqlServer.EntityFramework.dll) Namespace App.Data.Oracle.NHibernate (App.Data.Oracle.NHibernate.dll) Namespace App.Data.MySql.NHibernate (App.Data.MySql.Oracle.dll)

    Read the article

  • How do i get a href value from a link within a ul li list

    - by Akk
    I have an unordered list such as: <ul id="cities"> <li><a href="/london/">London<a></li> <li><a href="/new-york/">New York<a></li> <li><a href="/paris/">Paris<a></li> <ul> using jquery how do i get the href value for "New York"? Only the anchor text value is known through the client so i would like to find the matching anchor text and extract the href. Thanks

    Read the article

  • How to access the backing field of a base class using fluent nhibernate?

    - by Akk
    How do i set the Access Strategy in the mapping class to point to the base _photos field? public class Content { private IList<Photo> _photos; public Content() { _photos = new List<Photo>(); } public virtual IEnumerable<Photo> Photos { get { return _photos; } } public virtual void AddPhoto() {...} } public class Article : Content { public string Body {get; set;} } I am currently using the following to try and locate the backing field but an exception is thrown as it cannot be found. public class ArticleMap : ClassMap<Article> { HasManyToMany(x => x.Photos) .Access.CamelCaseField(Prefix.Underscore) //_photos //... } i tried moving the backing field _photos directly into the class and the access works. So how can i access the backing field of the base class?

    Read the article

  • How to dynamically assign asp.net control ID's

    - by Akk
    I want to do something like the following in an asp.net web form but get a Invalid Token error message: <ul> <%foreach (var item in Items) {%> <li> <asp:TextBox ID="<%= item.Id %>" runat="server" /> </li> <%} %> </ul> What alternative methods are there to achieve the desired result?

    Read the article

  • How to create a reference tables for collection classes using fluent nhibernate

    - by Akk
    How can i create a 3 table schema from the following model classes. public class Product { public int Id {get; set;} public string Name {get; set;} public IList<Photo> Photos {get; set;} } public class Photo { public int Id {get; set;} public string Path {get; set;} } I want to create the following table structure in the database: Product ------- Id Name ProductPhotos ------------- ProductId (FK Products.Id) PhotoId (FK Photos.Id) Photos ------ Id Path How i can express the above Database Schema using Fluent NHibernate? I could only manage the following the Mapping but this does not get me the 3rd Photo ref table. public class ProductMap : ClassMap<Product> { public CityMap() { Id(x => x.Id); Map(x => x.Name); Table("Products"); HasMany(x => x.Photos).Table("ProductPhotos").KeyColumn("ProductId"); } }

    Read the article

  • How to create reference tables using fluent nhibernate

    - by Akk
    How can i create a 3 table schema from the following model classes. public class Product { public int Id {get; set;} public string Name {get; set;} public IList<Photo> Photos {get; set;} } public class Photo { public int Id {get; set;} public string Path {get; set;} } I want to create the following table structure in the database: Product ------- Id Name ProductPhotos ------------- ProductId (FK Products.Id) PhotoId (FK Photos.Id) Photos ------ Id Path How i can express the above Database Schema using Fluent NHibernate? I could only manage the following the Mapping but this does not get me the 3rd Photo ref table. public class ProductMap : ClassMap<Product> { public CityMap() { Id(x => x.Id); Map(x => x.Name); Table("Products"); HasMany(x => x.Photos).Table("ProductPhotos").KeyColumn("ProductId"); } }

    Read the article

  • Find a HTML control using FindControl in ASP.NET

    - by Yongwei Xing
    Hi akk I add a select control to a ASPX page like below: hgc = new HtmlGenericControl(); hgc.InnerHtml = @"<select runat='server' id='my_selectlist'> \ <option value='volvo'>Volvo</option> \ <option value='saab'>Saab</option> \ <option value='mercedes'>Mercedes</option> \ <option value='audi'>Audi</option> \ </select>"; Then in a Button click event, I use the code below, try to get the value selected HtmlSelect s = (HtmlSelect)hgc.FindControl("my_selectlist"); label.Text = s.Value; I get a error:"Object reference not set to an instance of an object." Does anyone try it before? Best Regards

    Read the article

1