MVC derken Multi Page mi diyorsun? Mpa örneği yok. Sadece template i var.
<a class="postlink" href="http://aspnetzero.com">http://aspnetzero.com</a>
burada istediğin şey satışa sunulmuş durumda. Biraz pahalı tabii.
Aslına bakarsan Abp'nin ücretsiz dağıtılıyor olması bile çok hoş bişi. İleri düzey kodlanmış olması benim gibi kullanıcılar için sıkıntı yaratıyor ancak öğreniyoruz. Ben bu settings, permissions, dto,üçgeninden alnımın akıyla bir çıkayım. Güzel bir demo hazırlamak istiyorum.
<cite>sampath: </cite> Hi, A 1 :
ASP.NET Boilerplate provides several attributes and extension methods to define mappings. To use it, add Abp.AutoMapper nuget package to your project. Then, use attribute AutoMap for two way mapping, AutoMapFrom and AutoMapTo for one way mapping. Use MapTo extension methods to map one object to another. Example mapping definition:
Hope this will help to you. Good Luck ! :)
Let say we have a category entity like below.
public class Category : Entity<int>
{
public virtual int? ParentId { get; set; }
public virtual string Title { get; set; }
public virtual string Description { get; set; }
public virtual Category ParentCategory { get; set; }
public virtual ICollection<Category> SubCategories { get; set; }
public virtual ContentState ContentState { get; set; }
}
IInputDto
public class CategorySummaryInput : IInputDto
{
public ContentState ContentState { get; set; }
}
IOutputDto
public class CategorySummaryOutput : IOutputDto
{
public IList<CategorySummaryDto> Categories { get; set; }
}
CategorySummaryDto
[AutoMap(typeof(Category))]
public class CategorySummaryDto : EntityDto
{
public int? ParentId { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public IList<CategorySummaryDto> SubCategories { get; set; }
}
In Admin/Categories/Index view, I'll be needed sub categories of current category.
How can i map
public virtual ICollection<Category> SubCategories { get; set; }
to
public IList<CategorySummaryDto> SubCategories { get; set; }
Yea i saw it. But, what if i want to get UserId with providerKey (in my case to check if visitor registered be4.)
<cite>hikalkan: </cite> You can not return IQueryable from application service method. Just use ToList() after Where condition.
changed code below
...
var categories = _categoryRepository.GetAll().Where(c => c.CategoryState == state.ToString());
...
to
...
var categories = _categoryRepository.GetAll().Where(c => c.CategoryState == state.ToString()).ToList();
...
This time a get this error.
The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ObjectDisposedException: The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
This is the Stack trace
[ObjectDisposedException: The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.]
System.Data.Entity.Core.Objects.ObjectContext.get_Connection() +91
System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +273
System.Data.Entity.Core.Objects.ObjectQuery`1.Execute(MergeOption mergeOption) +83
System.Data.Entity.Core.Objects.DataClasses.EntityCollection`1.Load(List`1 collection, MergeOption mergeOption) +203
System.Data.Entity.Core.Objects.DataClasses.EntityCollection`1.Load(MergeOption mergeOption) +51
System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.Load() +59
System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.DeferredLoad() +438
System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.LoadProperty(TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject) +165
System.Data.Entity.Core.Objects.Internal.<>c__DisplayClass7`2.<GetInterceptorDelegate>b__1(TProxy proxy, TItem item) +205
System.Data.Entity.DynamicProxies.Category_93B8F10007F4823D6C15308F82C291EDF6CC0E4BAC3D32B099E0561F771A5140.get_SubCategories() +75
CallSite.Target(Closure , CallSite , Object ) +189
System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site, T0 arg0) +517
ASP.<>c__DisplayClassd.<PrintCategories>b__c(TextWriter __razor_helper_writer) in c:\Users\saYRam\Documents\Visual Studio 2013\Projects\Index Projects\Index.Web\Areas\Administrator\Views\Category\AddCategory.cshtml:82
System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +42
System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer, HelperResult content) +45
System.Web.WebPages.WebPageBase.Write(HelperResult result) +53
ASP._Page_Areas_Administrator_Views_Category_AddCategory_cshtml.Execute() in c:\Users\saYRam\Documents\Visual Studio 2013\Projects\Index Projects\Index.Web\Areas\Administrator\Views\Category\AddCategory.cshtml:91
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +270
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +122
System.Web.WebPages.StartPage.RunPage() +63
System.Web.WebPages.StartPage.ExecutePageHierarchy() +100
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +131
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +695
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +382
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +431
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +39
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +116
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +529
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +106
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +321
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +39
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +62
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9723757
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
i really did not understood why and where i made mistake.
ok sorry found InsertAndGetId method :)
bunu akıl ettiğn için teşekkürler dostum. Mükemmellik ayrıntılarda gizlidir. :)
I agree i need a sample module project like blog or something like that. Do anyone can share a sample module project to understand?
Yes i saw this when i check my codes. I remembered now. I was trying ReSharper shortcuts (Introduce Field) Sorry for unnecessary topic.