Interfaces

Posts   
 
    
quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 28-Sep-2010 20:03:09   

Is it possible to have base EntityClass, TypedList, and TypedView Interface? The idea is that I could then pass the interface along.

In my MVC I have many examples of this


<%@ Page Title="" Language="C#" 
    MasterPageFile="~/Views/Shared/Site.Master"
    Inherits="System.Web.Mvc.ViewPage<glossary_mvc.Models.ViewModelList<glossaryDB.TypedListClasses.ProjectListRow>>"
%>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Project: List</h2>

    <% Html.RenderPartial("Pager", Model.ListView); %>
    <% Html.RenderPartial("IndexResults", Model); %>
    <% Html.RenderPartial("Pager", Model.ListView); %>


    <p>
        <%: Html.ActionLink<ProjectController>(xx=>xx.Create(), "Add New") %>
    </p>
</asp:Content>

but I would like to to do this so I only need to have 1 copy.


<%@ Page Title="" Language="C#" 
    MasterPageFile="~/Views/Shared/Site.Master" 
    Inherits="System.Web.Mvc.ViewPage<glossary_mvc.Models.ViewModelList<ITypedListInterface>>"
%>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Project: List</h2>

    <% Html.RenderPartial("Pager", Model.ListView); %>
    <% Html.RenderPartial("IndexResults", Model); %>
    <% Html.RenderPartial("Pager", Model.ListView); %>


    <p>
        <%: Html.ActionLink<ProjectController>(xx=>xx.Create(), "Add New") %>
    </p>
</asp:Content>

In otherwords I'd like to replace this

Inherits="System.Web.Mvc.ViewPage<glossary_mvc.Models.ViewModelList<glossaryDB.TypedListClasses.ProjectListRow>>"

with this

Inherits="System.Web.Mvc.ViewPage<glossary_mvc.Models.ViewModelList<ITypedListInterface>>"

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 28-Sep-2010 22:03:11   

ITypedListLgp2 IEntityCollection ITypedView2

are the Adapter base interfaces for the three data structures. In Selfservicing you generally remove the "2"s... simple_smile

Pretty much everything in LLBLGen will inherit from an interface.

Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 29-Sep-2010 10:31:11   

entities implement IEntity2 (adapter) and IEntityCore, please check the runtime reference manual (available online as CHM) for more information.

Frans Bouma | Lead developer LLBLGen Pro
quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 29-Sep-2010 16:48:55   

How about TypedListRow or EntityRow ?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 29-Sep-2010 17:13:47   

What's an EntityRow?

Frans Bouma | Lead developer LLBLGen Pro
quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 29-Sep-2010 17:30:55   

Sorry, I have defined a TL called ProjectListTypeList but there is a generated class called a ProjectListRow. I was trying to make reference to that in a more abstact way.

<%@ Page Title="" Language="C#" 
    MasterPageFile="~/Views/Shared/Site.Master" 
    Inherits="System.Web.Mvc.ViewPage<glossary_mvc.Models.ViewModelList<glossaryDB.TypedListClasses.ProjectListRow>>"
%>

I am hoping to change it to:

Inherits="System.Web.Mvc.ViewPage<glossary_mvc.Models.ViewModelList<ITypedListRow>>"

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Sep-2010 05:47:59   

You have to use DataRow class, as TypedList inherits from DataTable and its rows inherits from DataRow.

David Elizondo | LLBLGen Support Team