12 |
13 |
Edit entry from table <%= DynamicData.Table.DisplayName %>
14 |
15 | <%= Html.ValidationSummary() %>
16 | <% using (Html.BeginForm("Update", null))
17 | { %>
18 | <%= Html.DynamicEntity(ViewData.Model, DataBoundControlMode.Edit)%>
19 |
20 |
21 |
22 | <%= Html.ScaffoldLink("Cancel", DynamicData.Table, "list")%>
23 |
24 | <% } %>
25 |
26 |
--------------------------------------------------------------------------------
/Src/Commons.Persistence.NoRM/DataContext/NormDataContextSessionManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.Serialization;
3 | using BoC.Persistence.Norm;
4 | using Norm;
5 |
6 | namespace BoC.Persistence.Norm.DataContext
7 | {
8 | public class NormDataContextSessionManager: ISessionManager
9 | {
10 | public IMongo Session
11 | {
12 | get
13 | {
14 | if (NormDataContext.OuterDataContext == null)
15 | {
16 | throw new DataContextException("You are using DataContextSessionManager but are accessing a session outside a unit of work");
17 | }
18 | return ((NormDataContext)NormDataContext.OuterDataContext).Session;
19 | }
20 | }
21 |
22 |
23 | }
24 |
25 | public class DataContextException : Exception
26 | {
27 | public DataContextException() { }
28 | public DataContextException(string message) : base(message) { }
29 | public DataContextException(string message, Exception innerException) : base(message, innerException) { }
30 | protected DataContextException(SerializationInfo info, StreamingContext context) : base(info, context) { }
31 | }
32 | }
--------------------------------------------------------------------------------
/Templates/DynamicData/Views/Shared/PageTemplates/New.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" ValidateRequest="false" Inherits="Microsoft.Web.DynamicData.Mvc.DynamicScaffoldViewPage" %>
2 |
11 |
12 |
13 |
<%= Page.Title %>
14 |
15 | <%= Html.ValidationSummary() %>
16 | <%
17 | using (Html.BeginForm("New", null))
18 | {%>
19 | <%=Html.DynamicEntity(DynamicData.Table.EntityType, DataBoundControlMode.Insert)%>
20 |
21 |
22 | <%=Html.ScaffoldLink("Cancel", DynamicData.Table, "list")%>
23 |
24 | <%
25 | } %>
26 |
27 |
--------------------------------------------------------------------------------
/Src/Commons/Extensions/ExpressionExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Linq.Expressions;
5 | using System.Text;
6 |
7 | namespace BoC.Extensions
8 | {
9 | public static class ExpressionExtensions
10 | {
11 | public static Expression