Search Results

Search found 40 results on 2 pages for 'csetzkorn'.

Page 1/2 | 1 2  | Next Page >

  • design pattern advice: graph -> computation

    - by csetzkorn
    I have a domain model, persisted in a database, which represents a graph. A graph consists of nodes (e.g. NodeTypeA, NodeTypeB) which are connected via branches. The two generic elements (nodes and branches will have properties). A graph will be sent to a computation engine. To perform computations the engine has to be initialised like so (simplified pseudo code): Engine Engine = new Engine() ; Object ID1 = Engine.AddNodeTypeA(TypeA.Property1, TypeA.Property2, …, TypeA.Propertyn); Object ID2 = Engine.AddNodeTypeB(TypeB.Property1, TypeB.Property2, …, TypeB.Propertyn); Engine.AddBranch(ID1,ID2); Finally the computation is performed like this: Engine.DoSomeComputation(); I am just wondering, if there are any relevant design patterns out there, which help to achieve the above using good design principles. I hope this makes sense. Any feedback would be very much appreciated.

    Read the article

  • uk change to gmail

    - by csetzkorn
    This is really annoying. google changed googlemail to gmail today and my android phone does not synch anymore. how can i change my email address (???) in my android so that it works with the switched gmail rather than googlemail? thanks. christian

    Read the article

  • sharp architecture, FluentNHibernate, automapper, DTO, 1:m persistence question

    - by csetzkorn
    Let us say we have a class A which has a reference to another class B (1:m) public class A { public virtual B B { get; set; } } I reflect this using FluentNHibernate within the sharp architecture and also manage to ‘initialise’ A and its B via a DTO and Automapper. The DTO contain A’s values and B (just B’s id value/A’s foreign key initialised). I was hoping that I can persist A by ‘just’ using its 'out of the box repository' without requiring B’s repository using: SaveOrUpdate(A); (A has been mapped using AutoMapper and contains B with its Id initialised) Was my assumption too naive? Can I achieve this somehow (without ever requiring B’s repository)? Or do I have to use A’s and B’s repository in, for example, the controller or some other service layer? Thanks. Best wishes, Christian

    Read the article

  • FNhibernate, GeneratedBy.HiLo, hibernate_unique_key etc.

    - by csetzkorn
    Hi, I have started using the s#arp architecture which uses FNhibernate and GeneratedBy.HiLo to generate primary keys (there is also table hibernate_unique_key). Apparently, this is recommended practise and I would like to stick with this. Now to my problem. I have used NHibernate and hbm mapping quite a bit and usually used identity columns for my primary keys. This allowed me to seed the database using SQL. Can I do this with the aforementioned setup (hibernate_unique_key table etc.). I need to do this as SQL insert is much more efficient than using NHibernate + C# to seed the db with a million entities. Any feedback would be very much appreciated. Thanks. Christian

    Read the article

  • URL encoding yes/or no?

    - by csetzkorn
    I have a restful webservice which receives some structured data which is put straight into a database. The data is send from an OS using wget. I am just wondering whether I actually need to URL encode the data and if so why? Please note that it is no problem to do it but it might be uneccessary in this scenario. Thanks. Christian

    Read the article

  • sharp architecture question - no strongly typed views

    - by csetzkorn
    Hi, I am trying to get my head around the sharp architecture and used the visual studio template as described on the web: http://wiki.sharparchitecture.net/VSTemplatesAndCodeGen.ashx This is all cool. Unfortunately, I cannot add a strongly typed view as easily as I am used to ‘under’ asp.net mvc. What can I do to ‘enable’ this in VS 2008 Prof? I have also installed asp.net mvc 2.0 and would like to reflect this in my ‘vs studio sharp environment’. Any pointers would be very much appreciated. Many thanks in advance. Best wishes, Christian

    Read the article

  • TDD - testing business rules/validation in ASP.NET MVC

    - by csetzkorn
    Hi, I am using the sharp architecture so I can easily use mocks etc. in my unit tests and/or during TDD. I have quite complicated business rules and would like to test them at the controller level. I am just wondering how other people do this? For me validation tests business rules at three levels: (1) Property level (e.g. property is required) (2) Intra property level (e.g. start date < end date) (3) Persistence level (e.g. name is unique, parent cannot be child of child) My validation framework also assigns errors to properties. I am just wondering what other people do? Do you write a test for each business rule and check whether the correct error message is assigned to the correct property (i.e. looking at the ASP.MVC ModelState)? I hope my question makes sense. Thanks a lot! Best wishes, Christian

    Read the article

  • sharp architecture question

    - by csetzkorn
    I am trying to get my head around the sharp architecture and follow the tutorial. I am using this code: using Bla.Core; using System.Collections.Generic; using Bla.Core.DataInterfaces; using System.Web.Mvc; using SharpArch.Core; using SharpArch.Web; using Bla.Web; namespace Bla.Web.Controllers { public class UsersController { public UsersController(IUserRepository userRepository) { Check.Require(userRepository != null,"userRepository may not be null"); this.userRepository = userRepository; } public ActionResult ListStaffMembersMatching(string filter) { List<User> matchingUsers = userRepository.FindAllMatching(filter); return View("ListUsersMatchingFilter", matchingUsers); } private readonly IUserRepository userRepository; } } I get this error: The name 'View' does not exist in the current context I have used all the correct using statements and referenced the assemblies as far as I can see. The views live in Bla.Web in this architecture. Can anyone see the problem? Thanks. Christian

    Read the article

  • XVal validation framework

    - by csetzkorn
    Hi, I started using this validation framework: http://blog.stevensanderson.com/2009/01/10/xval-a-validation-framework-for-aspnet-mvc/ Steve mentions that the DataAnnotationsValidationRunner implementation is slightly naive. Why is this and are there better implementations? I am also looking for a good example that uses this framework to validate database dependent business rules. Any pointers would be very much appreciated. Thanks. Christian

    Read the article

  • fluent nhibernate m-to-m with column

    - by csetzkorn
    Hi, I am used to hbm files and started using fluent nhibernate recently. Creating an m-to-m relationship between two entities A and B is quite simple In A I create: public virtual IList Bs { get; set; } and then I use: mapping.HasManyToMany(x = x.Bs); That’s it and I can do: A a = new A(); a.Bs.Add(b); My problem is that I would like to have an additional column in my dedicated m-to-m database table which holds the two foreign keys. What is the simplest way to achieve this in FNH? Would I have to create a dedicated entity for the m-to-m realtionship or is there a simpler solution? Thanks. Best wishes, Christian

    Read the article

  • asp.net mvc - bootstrapping object via model binder

    - by csetzkorn
    Hi, I have a domain object Thing which can contain several Categories. So I have implemented my HTML helper to create a checkbox group of all possible Categories. I have no problem receiving: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(Thing Thing, List<string> Categories) However I am wondering whether I could use a custom Model binder to use just this: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(Thing Thing) So basically I am looking for a way to use the model binder to bootstrap the object tree/graph. Any pointers appreciated. Thanks. Christian

    Read the article

  • sharp architecture question, nhibernate validation

    - by csetzkorn
    I have marked certain properties in my domain object for the nhibernate validation 'framework'. If I do this in my controller explicitly: ICollection<IValidationResult> test = bla.ValidationResults(); I get the validation errors which I could add to my asp.net mvc modelstate ideally, i would like an exception being thrown during: bla = blaRepository.SaveOrUpdate(bla); if i try to save or update the domain object. why is this not happening? my domain object bla derives from Entity. do I have to register something somehow? Thanks. christian

    Read the article

  • similarity match

    - by csetzkorn
    Many search engine have the 'did you mean' functionality. Is there a simple way to use (N)Hibernate (e.g. ICriteria) to find an entity (e.g. keyword) based on similarity. Please note that I do not mean Expression.Like or something like this. I hope this question makes sense. Thanks. Christian

    Read the article

  • CSS line break problem

    - by csetzkorn
    Hi, If I have a very long string (without spaces!) can I force the browser to line break it, for example, in a table's td via CSS. Width does not seem to have any effect. Thanks! Christian

    Read the article

  • change custom mapping - sharp architecture/ fluent nhibernate

    - by csetzkorn
    I am using the sharp architecture which also deploys FNH. The db schema sql code is generated during the testing like this: [TestFixture] [Category("DB Tests")] public class MappingIntegrationTests { [SetUp] public virtual void SetUp() { string[] mappingAssemblies = RepositoryTestsHelper.GetMappingAssemblies(); configuration = NHibernateSession.Init( new SimpleSessionStorage(), mappingAssemblies, new AutoPersistenceModelGenerator().Generate(), "../../../../app/XXX.Web/NHibernate.config"); } [TearDown] public virtual void TearDown() { NHibernateSession.CloseAllSessions(); NHibernateSession.Reset(); } [Test] public void CanConfirmDatabaseMatchesMappings() { var allClassMetadata = NHibernateSession.GetDefaultSessionFactory().GetAllClassMetadata(); foreach (var entry in allClassMetadata) { NHibernateSession.Current.CreateCriteria(entry.Value.GetMappedClass(EntityMode.Poco)) .SetMaxResults(0).List(); } } /// <summary> /// Generates and outputs the database schema SQL to the console /// </summary> [Test] public void CanGenerateDatabaseSchema() { System.IO.TextWriter writeFile = new StreamWriter(@"d:/XXXSqlCreate.sql"); var session = NHibernateSession.GetDefaultSessionFactory().OpenSession(); new SchemaExport(configuration).Execute(true, false, false, session.Connection, writeFile); } private Configuration configuration; } I am trying to use: using FluentNHibernate.Automapping; using xxx.Core; using SharpArch.Data.NHibernate.FluentNHibernate; using FluentNHibernate.Automapping.Alterations; namespace xxx.Data.NHibernateMaps { public class x : IAutoMappingOverride<x> { public void Override(AutoMapping<Tx> mapping) { mapping.Map(x => x.text, "text").CustomSqlType("varchar(max)"); mapping.Map(x => x.url, "url").CustomSqlType("varchar(max)"); } } } To change the standard mapping of strings from NVARCHAR(255) to varchar(max). This is not picked up during the sql schema generation. I also tried: mapping.Map(x = x.text, "text").Length(100000); Any ideas? Thanks. Christian

    Read the article

  • shape fitting - gis

    - by csetzkorn
    Hi, Let us say I have two shapes. One is a polygon and the other a square. Each shape consists of lines which two points (a latitude/logitude pair). I would like to determine the degree to which the square is within the polygon (percentages 0 ... 100). Is this possible? Any pointers to relevant algorithms would be very much appreciated. Thanks. Christian

    Read the article

  • similarity between strings - sql server 2005

    - by csetzkorn
    Hi, I am looking for a simple way (UDF?) to establish the similarity between strings. The SOUNDEX and DIFFERENCE function do not seem to do the job. Similarity should be based on number of characters in common (order matters). For example: Spiruroidea sp. AM-2008 and Spiruroidea gen. sp. AM-2008 should be recognised as similar. Any pointers would be very much appreciated. Thanks. Christian

    Read the article

  • automapper - how to map object list

    - by csetzkorn
    Let us say my domain object can contain a bunch of objects like this: List<Thing> Things where Thing is defined like this: class Thing ( public int ThingId { get; set; } public string ThingName { get; set; } ) My DTO contains List<string> ThingIds; List<string> ThingNames; The question is how can I use automapper to map Things to the 'relevant bits' in the DTO? Thanks. Christian

    Read the article

  • unit test service layer - NUnit, NHibernate

    - by csetzkorn
    Hi, I would like to unit test a DEPENDENT service layer which allows me to perform CRUD operation without mocking using NUnit. I know this is probably bad practice but I want to give it a try anyway - even if the tests have to run over night. My data is persisted using NHibernate and I have implemented a little library that 'bootstraps' the database which I could use in a [Setup] method. I am just wondering if someone has done something similar and what the fastest method for bootstrapping the database is. I am using something like this: var cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly("Bla"); new SchemaExport(cfg).Execute(false, true, false); to establish the db schema. After that I populate some lookup tables from some Excel tables. Any feedback would be very much appreciated. Thanks. Christian

    Read the article

  • FluentValidation + s#arp

    - by csetzkorn
    Hi, Did someone implement something like this: http://www.jeremyskinner.co.uk/2010/02/22/using-fluentvalidation-with-an-ioc-container/ in s#arp? Thanks. Christian PS: Hi, I have made a start in using FluentValidation in S#arp. I have implemented a Validator factory: public class ResolveType { private static IWindsorContainer _windsorContainer; public static void Initialize(IWindsorContainer windsorContainer) { _windsorContainer = windsorContainer; } public static object Of(Type type) { return _windsorContainer.Resolve(type); } } public class CastleWindsorValidatorFactory : ValidatorFactoryBase { public override IValidator CreateInstance(Type validatorType) { return ResolveType.Of(validatorType) as IValidator; } } I think I will use services which can be used by the controllers etc.: public class UserValidator : AbstractValidator { private readonly IUserRepository UserRepository; public UserValidator(IUserRepository UserRepository) { Check.Require(UserRepository != null, "UserRepository may not be null"); this.UserRepository = UserRepository; RuleFor(user => user.Email).NotEmpty(); RuleFor(user => user.FirstName).NotEmpty(); RuleFor(user => user.LastName).NotEmpty(); } } public interface IUserService { User CreateUser(User User); } public class UserService : IUserService { private readonly IUserRepository UserRepository; private readonly UserValidator UserValidator; public UserService ( IUserRepository UserRepository ) { Check.Require(UserRepository != null, "UserRepository may not be null"); this.UserRepository = UserRepository; this.UserValidator = new UserValidator(UserRepository); } public User CreateUser(User User) { UserValidator.Validate(User); ... } } Instead of putting concrete validators in the service, I would like to use the above factory somehow. Where do I register it and how in s#arp (Global.asax)? I believe s#arp is geared towards the nhibernator validator. How do I deregister it? Thanks. Best wishes, Christian

    Read the article

  • css problem - 'post link'

    - by csetzkorn
    Hi, I am no css expert so I am wondering whether someone could help. I have several forms to delete an item like this: <form action="/Items/DeleteItem" class="deleteForm" method="post"> Some text <input id="Id" name="Id" value="14014" type="hidden"> <input value="Delete" class="link_button" type="submit"> </form> This should look like this: Some text Delete Here ‘Some text’ describes the item and Delete is a ‘link’ which performs a post request to delete the item (as virtually all browsers only support the post and get requests). I have started to style things (CSS below) but the ‘Delete’ ‘link’ is still slightly offset in relation to ‘Some text’ (at least in firefox). I would appreciate any help with the css. Thanks! .link_button { background-color:white; border:0; color:#034af3; text-decoration:underline; font-size:1em; font-family:inherit; cursor:pointer; float:left; margin:0; padding:0; } .deleteForm { float:right; margin:0; padding:0; } Christian

    Read the article

  • paging helper asp.net mvc

    - by csetzkorn
    Hi, I have implemented a paging html helper (adapted from steven sanderson's book). This is the current code: public static string PageLinks(this HtmlHelper html, int currentPage, int totalPages, Func pageUrl) { StringBuilder result = new StringBuilder(); for (int i = 1; i <= totalPages; i++) { TagBuilder tag = new TagBuilder("a"); tag.MergeAttribute("href", pageUrl(i)); tag.InnerHtml = i.ToString(); if (i == currentPage) tag.AddCssClass("selectedPage"); result.AppendLine(tag.ToString()); } return result.ToString(); } This produces a bunch of links to each page of my items. If there are many pages this can be a bit overwhelming. I am looking for a similar implementation which produces something less overwhelming like this: where 6 is the current page. I am sure someone must have implemented something similar ... before I have to re-implement the wheel. Thanks. Christian

    Read the article

  • versioning in Fluent NHibernate

    - by csetzkorn
    In my NHibernate mapping files I used: <version name="Version" column="Version" /> to implement versioning. How do I achieve this using fnhibernate? What should go in here? public class blaMap : IAutoMappingOverride<bla> { public void Override(AutoMapping<bla> mapping) { ???? } } thanks. christian

    Read the article

  • mvc contrib pager question - AsPagination

    - by csetzkorn
    Hi, I might be wrong but is the AsPagination method not very inefficient as it sucks all the data from a repository first to initialise TotalItems etc.? So paging is not used to make the data access more efficient. I have not found any examples which use a repository and 'true' paging (i.e. uses TOP etc. in the atcual SQL). How do I use the Pager if I have a repository method with this signature: IList GetData(int? page, out int TotalItems) Any feedback would be very much appreciated. Thanks. Christian

    Read the article

1 2  | Next Page >