I was thinking about a scenario which is often seen. Let's start form the user perspective. He opens a web page and there is some data table and filters like that: Filter by: equals User chooses a field name and enters some value and submits that. Web application (presentation layer) takes user input and transfers the request to the web service (using automatic .NET XML serialization). So it seems data transfer object pattern can be used here. Then my web service transforms that DTO to some valid query. Let's assume we are using some OR/M tool to query it for objects which satisfies the query. Also let's assume that OR/M tool offers some easy way to construct dynamic queries (BTW, LINQ-to-SQL has some problems with this). So the question is - how to better pass data from user form to the data access layer (OR/M tool) so the dynamic query could be generated with less hassle? It would be awful to have web method for each field like this: GetCustomerByName(string name), GetCustomerByCity ... and so on. Then I have to analyze the user input and call appropriate web method. But maybe it is the right way? I prefer some method GetCustomersByFilter, so then I can almost directly pass the request to web service and then can convert the request to query in OR/M servicing component. But what to pass to this GetCustomersByFilter method? Dictionary with field names as keys? Many nullable parameters? Custom objects? It would be nice to use the same data structures that are used to pass data to the web application - the same data transfer objects, I guess. Like this: Customer[] GetCustomersByFilter(Customer filter); but then I have to allow all the fields of Customer to be nullable so I can later see which fields are used as filters. And if that does not correspond my business/validation rules (if rules say - some property cannot be null) than it would be a bit confusing. Also if I would like to use some generator to create web forms based on my DTO objects, it would be impossible to mark required fields easily just by detecting if some field is nullable or not. So maybe I need some other object, like CustomerFilter with all nullable fields? Wouldn't it be overkill to have two classes for each object (also, accounting that those DTOs are converted to domain entities later - then we have even more classes)? This dynamic filtering issue is really bugging me. Has anybody any experience with that, especially using domain driven design? Thanks.
midix
Posts
-
Dynamic filters in n-tier applications - how to implement? -
Opinion survey about ORM / DAL tools:confused: anybody?
-
Opinion survey about ORM / DAL toolsHi all. I am writing some paperwork about Object Relational Mapping / Data Access Layer development technnoligies and tools (like Microsoft ADO/DAO, LINQ to SQL, Entity Framework, (N)Hibernate, Doctrine, Apache iBatis and other SQL / CRUD generators and mappers). I would like to know other programmers' thoughts about the subject so my work is not based only on my own subjective opinion. If someone here has experience with ORM / DAL tools (or have created own ORM / DAL) then I would be grateful to know about your findings. I can suggest some factors that you can take as a basis: learning curve - how hard / easy it was to get into this technology, how long did it take; was the quality of the documentation appropriate? introducing the technology into an existing project - how long did it take, was it hard, what problems did you encounter? Where there any problems - "deal breakers" that made you choose not to use some certain ORM ?DAL development tool? starting a new project and choosing the ORM / DAL technology - how much the ORM ?DAL dictates the rules for an architecture of the new project? where there any compromises needed just to adapt your project architecture to the ORM / DAL technology? porting some project to another data base / working environment - how did ORM / DAL tools help or create additional issues? flexibility - if project specifications changed, how the ORM / DAL reacted? Was there any need to throw away existing ORM / DAL and choose another or create your own layer from scratch? And considering all the above, what would be your ideal ORM / DAL tool, what features should it have and what should it avoid? Do you prefer high abstraction from SQL or maybe a tool that generates modifiable SQL / CRUD that you can tweak later and also the changes do not get lost when you use the tool to regenerate something? And other useful ideas about this topic are welcome. Thanks.
-
ORM tools in domain driven design?Good day! I am a student and I am doing a study on Object Relation Mapping tools and how they fit into various software design patterns and approaches. For now I have tried some tools and read about their weaknesses and strengths related to ModelViewController and n-tier design patterns and also have an experience with some projects. But lately I have found out about domain-driven design (which involves also a model-driven design at some point because domain objects together make a domain model). And I got a bit confused how does this all fit together with ORM and what is ORM role in those designs. I have found this good article about practical example how to use MVC and domain driven design with Zend and PHP: angryobjects.com/2009/03/30/writing-robust-php-backends-with-zend-framework/comment-page-1/#comment-1201 The author suggests keeping the domain model completely clean and unaware of underlying persistence. Only some ServiceLayer is needed to convert domain objects to/from persistence objects and as I understood this involves also CRUD operations. But I want to know what happens if we introduce some ORM into this scenario. As I understand, the right way is to create domain model first and only after that think about how this model will be persisted with or without ORM. Let’s say, we have designed some domain model and now want to use ORM tool for easier persistence. ORM tool lets us generate some entity model and it is just logical that we’ll try to match this entity model with our domain model as closely as possible. But then we get some kind of duplication! We have a domain model with business logic in it and we have the same domain entities but with CRUD or various persistence attributes (maybe not visible but inherited from some base-class or interface). Then the question is - how good or bad idea is to merge our domain model with the ORM generated entities? When is it acceptable and allows us to say that we still have a good domain – driven design and when it is not acceptable because of too much “persistence aware” domain? Is it some trade-off thing going on here (clean domain entities versus duplicated entities)? I found this article: ibm.com/developerworks/java/library/j-pop1/ where they use some base classes and interfaces to implement common functionality in the domain model. But still the model entities contain some persistence awareness because of that inheritance. How good or bad is it from the point of view of clean domain model? Also the same problem arises when we try t
-
C# library for visual network layout / flow chart neededOh, that is great, if only it was C#. Anyway, thanks, I'll see if I can port it to C#.
-
C# library for visual network layout / flow chart neededHi all! I have a small project where I need to create a visual family tree editor. Before I start reinventing the wheel, I would like to know if there are any free or open source C# library which lets me do the following: -add, select and remove elements (simple boxes with title is enough) with mouse and context menu -connect and disconnect elements with mouse. If I have this, I 'll be able to do the rest myself (attaching some data structure to the visual tree and storing the tree to a database). Thanks for any ideas.
-
How to get a desktop screenshot without my application window? [modified]Hi all. I am trying to create a simple magnifier application which follows the mouse and magnifies the portion around the mouse cursor. I know how to get a screenshot of a desktop. I have tried GDI way and DirectX9 Surface way, but DX surface is too slow for realtime capturing. So I am staying with GDI. The problem is - when I get a screenshot my magnifier application is included, too. I tried to GetNextWindow and GetFocus to get HDC only for the active window and then render HDC into memory DC. But it is a nightmare - some applications have multiple windows so I get only one of them and the other part of the shot is a mess (from previous shots). I guess it would be really hard to get DC for every window beneath my own and to combine all the DC images myself. Brrr... One approach could be to hide my app, capture screen, restore my app. But it is not suitable for realtime work. Of course, I know that Windows keeps track of window clipping regions so area behind my window would not be updated in other windows WM_PAINT. But I think I can force it to render if I use WS_EX_LAYERED style and 99% visibility for my app - then Windows invalidates area even behind my window. Of course, I can remove CAPTUREBLT flag from BitBlt when capturing and then I won't get my window because all layered windows would be ignored. But then I do not get any of the layered windows (like tooltips etc.). I know that Vista Magnification API can do the trick but it does not work on XP :(( So the problem is - how can I virtually "erase" my app from the screenshot and get area behind it? Thanks for any ideas.
modified on Friday, December 26, 2008 9:45 AM
-
Draggable, connectable windows classes - where to find them?OK, finally I did it myself. But I had to completely override OnPaint and OnErase functionality and call redraws in another ways. It still is kinda jumpy but it works!
-
Draggable, connectable windows classes - where to find them?Hi. I am creating a project which needs a GUI (although it can work without GUI). I need some classes or some library which could manage creating small dragable windows with multiple nodes on the sides of the windows. And of course ability to interactively connect window nodes with lines between windows. I started to do it myself and I have already made windows and connection management but I have many troubles - it is hard to track and disable all these redraws and erases for the main window and child windows so I have a total mess of overriden OnPaint and OnEraseBackground message handlers which still do not act as I need. So I thought maybe there are some free downloadable snippets/classes/libraries which could help me? I know many programs have such "subwindow networks" (like kX driver project, Microsoft DirectX Graph Edit Utility). The problem is that I cannot imagine how could I call this class library or smth. like that so I do not know what to "google" for (English is not my native). The only thing I found is GO++: http://www.hallogram.com/go++/index.html[^] and it is not free. But it looks like the thing I need. Would be grateful for some useful advice or link to something like GO++ open-source or free library. Thanks
-
Focusless window - how to make that?Thanks a lot! I knew that the solution is simple just did not want to try out all of message handlers available; so your help eased my life a lot :) -- modified at 11:42 Tuesday 28th February, 2006 Oops! That does not work. Seems that ActiveX control is stronger - I completely hide my window and try filter with SWP_NOACTIVATE but nothing. Maybe if I tell that ActiveX control is WebBrowser that would give you some more ideas? Thanks
-
Focusless window - how to make that?MFC is so full of capabilities that I am a bit confused in the documentation and help files and cannot find the solution. The problem: I have a simple CDialog based app window with an ActiveX control in it. This ActiveX control has a feature that I do not need at all: it makes the dialog box jump in the foreground sometimes. Even if I hide the window (ShowWinow(SW_HIDE)), my app steals the input focus. It is normal behaviour for that ActiveX control and I do not want (and can't) modify the ActiveX control. But I want to make my app "focusless" - that means if it receives some message to activate or jump foreground or capture keyboard and mouse focus, it should not respond. Have tried OnActivate, OnActivateApp, OnNcActivate, OnSetFocus, but these handlers are triggered AFTER the actual event and this does not work for me. I even agree to have this window to be invisible all the time (or maybe you know how to get ActiveX work without any window at all? , it just needs to be silent in the background until it does what it has to do and then exits. Any ideas? Thanks (at least for reading this)