This project is read-only.

Select Commands - can't find in DTO layer

Oct 21, 2010 at 4:16 PM

I have created a custom Select Command on one of my tables. The stored procedure has been created, as has the method within the business object and the class within the select methods of the business layer.

However, I am developing using DTOs and the DAL layer. Methods are created there for fields I have marked as searchable, but no methods have been created for my custom Select Command.

Presumably this is an error? I thought the same methods would be available both from the business layer and also from the DAL proxy?

Oct 27, 2010 at 8:22 AM

Does anyone have an answer to this?

Oct 29, 2010 at 2:21 AM

It is currently not generating the methods for custom select commands. I am looking into it now

Nov 1, 2010 at 10:16 AM

Helow guys  it was my first question when i was looking at the NHydrate  generated code at first. Guys now i use modified version of CodeEngine - if i correctly  understand you custom select it's   custom Where custom Orderby (may be  GroupBy ...) clauses dynamically  formed from input params.

 you can Look at this framework  in it's article  here

now i'm developing  -transaction meta scripting- based inside on the CodeEngine and  client communication( silverlight) interfaces for it

If you are interested in my variant of CodeEngine i can sent it to you( in som time) . I 've add  Commands Building facade and LINQ executor based on the  facade.          

Nov 5, 2010 at 11:38 AM
codetools wrote:

It is currently not generating the methods for custom select commands. I am looking into it now

Hi @codetools, just wondered if there was any progress with this yet?

Thanks a lot


Nov 5, 2010 at 12:00 PM

ian and codetools -     i'd want to ask you - what do you mean by CUSTOM SELECT? what features we are talking about?   

Nov 5, 2010 at 3:57 PM

There is a namespace "SelectCommands" that has many generated select commands that are used to query data internally. For example you will find select by primary key, foreign key, etc. These classes wrap calls to stored procedures in the database layer all generated from your model. You can create your own select command objects that queries data in any way you wish and hook it to a stored procedure you write. This is just a layer of customization for you to use if needed. Sometimes people have very specific queries they wish to write and this process provides a mechanism to store this information in a strongly type fashion.

Nov 8, 2010 at 7:43 AM

so i'd want to understand  - what you mean when sad - It is currently not generating the methods for custom select commands. I am looking into it now-

what are you looking into? - DynamicSQL generation? - if it's so what can you say about CodeEngine or may be you can offer other tool?

Are you going to include in the future  dynamic sql SelectCommands or no?

Nov 8, 2010 at 1:51 PM

Perhaps I did not fully explain the concept of custom select commands. They are simply a mechanism to pull data from the database using predefined stored procedures. Your model has defined relations between tables and also fields marked as queryable. Since the model knows about these at generation time, it can create stored procs and the methods that call them. That said there is also a dynamic SQL aspect to the product as well. If you use the “RunSelect” method of any object collection using a lambda syntax you will create dynamic SQL in the background. So the product does extensively use dynamic SQL, if you use the lambda syntax, just like standard Entity Framework does. However if you use the select field syntax, select all, or walk a relationship then the backend stored procedures are used which are accessed with the select command objects. You can follow the pattern and write your own stored procs and select commands if you wish. Some organizations require all data access go through stored procs. This would be one reason for writing your own. I admit it is easier to use the lambda syntax since it is compile time checked and there is no need to write any back end to use it.

In relation to CodeEngine I have briefly looked at it and it seems to be a non-integrated, generate-once product for only data layers. This is a different class of product than nHydrate. We wish to provide a complete way to manage your database and DAL in one model that can be regenerated as many times as your wish and track database changes through the life cycle of your product by versioning your API and database.

Nov 9, 2010 at 7:17 AM
Edited Nov 10, 2010 at 2:27 PM

thank you guys  

next question -    how about next situation - we have conditions:   

                    - 1condition I'm  talking about  views classes  and  dynamic SQL in runtime, because as you sad tables selections made for   --- simply a mechanism to pull data from the database using predefined stored procedures---- 

                   - 2 condition   - server should dynamically generate sql from List<WhereFilter>   - because it's foolish to make each select methods for each possibly combination for view of 10 or more fields.       

                   - What you can say as a solution in NHydrate? - May be lambda expressions or  WHAT?

                   - 3 condition - how about transmitting   List of <WhereParams> from rich client to server - in such case server can't receave lambda from rest or wcf Data Service  because we can't send it throw the service from client  .....  or not ?  What sould be as interface from rich client to server ?  

                    So the question may be like this -  what should i use for such dynamic sql  select command(condition1,condition2,condition3) ?  

                 ------>   My answer was to get CodeEngine SelectQueryBuilder class    and use  simpliest enums and clauses  as interface    betweeen server and rich client, may be even inside one container- as you wish(i use such method).

                --------->   But may be you can tell me something  else to decide this problem ? 


       Main Question:      Is that dynamic sql select command(condition1,condition2,condition3)  ----  in you looking aims?  or  may be i've missed some option in the already generated code    

              That's not to bother you      I'm interesting in NHydrate and It's interesting for me ..... thanks for your patienсe )


Nov 12, 2010 at 1:42 PM
codetools wrote:

It is currently not generating the methods for custom select commands. I am looking into it now

Hi @codetools, just checking if there is any progress yet with the custom select commands for DTO object?

Thanks, Iain

PS @xidius - the idea is to generate a stored procedure which does a specific, defined SELECT that you can code, then to add methods that specifically call that new stored procedure

Nov 12, 2010 at 2:13 PM
Edited Nov 12, 2010 at 3:34 PM

iainfogg want ask you too   - what option you want from    Custom Select Commands? 


Guys @codetools  how about  such thing as custom MULTIPLE SELECTION.  container that bring  some collections to client and back...- for Views?

And can you share - what are you working at now - in the context of  the CUSTOM SELECTION area ?  


Nov 12, 2010 at 3:17 PM

xidius, I think it would be easier if you create a new discussion thread to ask your questions, as I am trying to get an answer to a specific question about when the custom selects may be working for DTOs, but your questions are about other things. It unfortunately makes this more confusing, and makes it harder for me to get my answer that I need. Hope that's OK, really don't want to seem at all rude, but I need to know what's happening with the custom selects.

@codetools, any ideas on timescales please?


Nov 12, 2010 at 3:47 PM

ok  i understand   i see you only want to know about  custom Select Command marked as searchable.  i'm sorry -    :)   


Nov 17, 2010 at 8:17 AM
codetools wrote:

It is currently not generating the methods for custom select commands. I am looking into it now

Hi @codetools, just wondered if there was any progress with this yet? It would be really helpful to have a timescale for this, as I have some work depending on it

Thanks a lot


Nov 22, 2010 at 11:57 AM

Hi, wondering if there is any progress on this yet?


Nov 25, 2010 at 9:15 AM

Since 5th November, I've been asking if there's been any progress with adding custom select commands to DTO but I've not had any reply, and I've also tried emailing as well.

I really don't want to seem unappreciative or rude - I know you're not making money from this. BUT if people are going to use nHydrate on proper business systems, rather than just tinkering with it at home, there has to be some way to get answers to questions to help us along. Otherwise, it's just too big a risk. The system seems great, but we can't use it if we end up getting stuck and can't get assistance.

PLEASE would you update this post with any actual or planned development on adding custom select commands to DTO, in reference to the comment on this post from 29th October?

If this seems like a moan, I'm sorry - I just need an answer and I can't find any other way to get one.



Nov 25, 2010 at 5:35 PM

I am sorry for the lack of communication. We have been working on this for the next release. This will hopefully come out this weekend. The same "SelectBy[Name]" method that appears on the DAL will now also appear on the DALPRoxy extensions. So if you are using the extensions and have a Customer object defined, an object of type "List<CustomerDTO>" will have a new extension method for each custom select command defined. I think this is what you needed right?