Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

one interface implementing another

Posted on 2012-03-23
3
Medium Priority
?
282 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

604 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