I think that's inherent with the QueryOver syntax, though it's harmless.
http://stackoverflow.com/questions/13633617/why-does-resharper-tell-me-i
mplicitly-captured-closure-end-start might be of interest.

 

/Pete

 

From: [email protected] [mailto:[email protected]] On
Behalf Of thecodefool
Sent: 02 April 2013 14:28
To: [email protected]
Subject: [nhusers] QueryOver alias Implicitly Captured Closure

 

Hello,

 

I have searched through the topics and did not find anything that seemed
to explain this issue so here goes:

 

I have two tables Test and TestType in the Test table there is a
reference to test type - very basic.

 

Here is my method to query the two

 

private IQueryOver<Test, Test> GetBaseQuery(ISortModel sortModel,
IPageModel pageModel) {

            TestType testTypeAlias = null;

            Test testAlias = null;

            IQueryOver<Test, Test> query;

            TestViewModel viewModel = null;

            //Default to sort by
TestName------------------------------------------------------

            if (string.IsNullOrEmpty(sortModel.SortBy))

                sortModel.SortBy = "TestName";

 

            switch (sortModel.SortBy) {

                case "TestTypeName":

                    query = sortModel.SortAscending ?
Session.QueryOver(() => testAlias).OrderBy(p =>
testTypeAlias.TestTypeName).Asc

                        : Session.QueryOver(() => testAlias).OrderBy(p
=> testTypeAlias.TestTypeName).Desc; break;

                default:

                    query = sortModel.SortAscending ?
Session.QueryOver(() => testAlias).OrderBy(p => testAlias.TestName).Asc

                        : Session.QueryOver(() => testAlias).OrderBy(p
=> testAlias.TestName).Desc; break;

            }

 

            query.JoinQueryOver(x => testAlias.TestType, () =>
testTypeAlias, JoinType.LeftOuterJoin)

                .SelectList(list => list

                .Select(() => testAlias.Id).WithAlias(() =>
viewModel.Id)

                .Select(() => testAlias.TestName).WithAlias(() =>
viewModel.Name)

                .Select(() => testTypeAlias.Id).WithAlias(() =>
viewModel.TestTypeId)

                .Select(() => testTypeAlias.TestTypeName).WithAlias(()
=> viewModel.TestTypeName))

                .Skip((pageModel.CurrentPageIndex - 1) *
pageModel.PageSize);

            return query;

        }

 

 

Wherever I have:

Session.QueryOver(() => testAlias) 

or 

query.JoinQueryOver(x => testAlias.TestType, () => testTypeAlias,
JoinType.LeftOuterJoin)

or 

OrderBy(p => testTypeAlias.TestTypeName)

 

I get a resharper complaint that I have an Implicitly Captured Closure

 

I have tried to rewrite it but can't figure it out.  

 

Any idea how I would rewrite the above method so that I will not have
this issue?

 

Thanks in advance

-- 
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to