Solved

one interface implementing another

Posted on 2012-03-23
3
271 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 75

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 75

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Suggested Courses

739 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