This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
SORRY for "Exclude Id from Entity<TEntity>" Thread but there has been a problem. If I want to use stored procedure I must to create a derived class (such as CustomClass) from Entity<TEntity> and automatically UnitOfWork.Find<CustomClass>("procedurename", procQueryInstance) will return entities with Id. |
|
|
We can't guarantee how this will work with LightSpeed. Your EntityBase class is effectively opting out of the normal identity conventions. This means that there will be no way to handle associations, to identify existing entities, to save updates, etc. You may also have a problem because it looks like everything is getting Id 0; that will cause problems for the unit of work's identity map and if you perform a second query in the same UOW instance, then you may find yourself getting the "cached item with Id 0" back for each result. Effectively what you have here is a way of loading isolated value types, rather than domain entities. If this is what you want, a better idea may be to use projections. You can't do a database-level projection over a stored procedure, but you can do it client side: var addresses = unitOfWork.Find(new ProcedureQuery(...)) Note that the stored procedure still has to return an ID column because this materialises the entities and then projects them into the value type. If you have stored procedures that *don't* return an ID column, that's not something we support. We could look at extending the IUnitOfWork.Project() method to support stored procedures, and the LINQ provider to enable stored procedures to be projected into a named or anonymous type. Perhaps you could say more about what problem you're trying to solve, and we'll see if we can offer some advice on an alternative approach. |
|
|
I know S.P. return an ID column, buuuut I have S.P. that don`t return an ID column. There is my scenarios and maybe you will understand why I created custom class EntityBase derived from Entity. 1) When SP return an ID Column: CREATE PROCEDURE [dbo].[StoredProcName] @Xvalue varchar(10) = NULL,@Yvalue varchar(10) = NULL AS SELECT DISTINCT [ID], results: more than 1000 records . Wrong!! 2) CREATE PROCEDURE [dbo].[StoredProcName] @Xvalue varchar(10) = NULL,@Yvalue varchar(10) = NULL AS SELECT DISTINCT [0] as [ID], results: less than 500 records . that`s GOOD !!! 3) but I would like that SP not return an ID Column and I created this EntityBase custom class my SP look like this: CREATE PROCEDURE [dbo].[StoredProcName] @Xvalue varchar(10) = NULL,@Yvalue varchar(10) = NULL AS SELECT DISTINCT [returnX1] as [X1] results: same as 2) well... I expect the new version is released LS 3.0 ;) |
|