Solved

one interface implementing another

Posted on 2012-03-23
3
262 Views
Last Modified: 2012-06-27
I want to have the two interfaces below.

public interface IWriteable<T>
                where T : class
{
    void Add(T newEntity);
    void Remove(T entity);
}

Open in new window


public interface IReadable<T>
            where T : class
{
    IQueryable<T> FindAll();
    IQueryable<T> FindWhere(Expression<Func<T, bool>> predicate);
    T FindById(int id);
    T FindById(Guid id);
}

Open in new window


Basically I want to control certain elements of different aspects of my website.

So some repositories will only be able to read certain classes, some read/write.

What I want though is for IWriteable to also Implement IReadable as my attitude is if something has the permission to write it is ok to read.

Using my interface above how to I make Iwritebale implement IReadabale?
0
Comment
Question by:scm0sml
  • 2
3 Comments
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 37757358
Interfaces cannot provide implementation details, but you can certainly mark you IWriteable as "implementing" (only word I could think of, sorry) the IReadable interface, whose implementation responsibilities would also be passed along to classes implementing IWriteable. You simply need to note it in the implementation list (again, sorry). For example:

public interface IWriteable<T> : IReadable<T>
                where T : class
...

Open in new window

0
 

Author Comment

by:scm0sml
ID: 37757381
Thats exactly what I was after thanks!

Probably didint explain myself very well!
0
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 37757389
Probably didint explain myself very well!
I'd say you explained it just fine  = )

Glad to help!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now