public IRole Represent(IRepresentationContext <long> representationContext) { if (representationContext == null) { representationContext = new RepresentationContext <long>(); } return(representationContext.GetOrAdd(Id, () => new RoleImpl(Name, Permisions))); }
protected override IRole Represent(Role entity, IRepresentationContext <long> representationContext = null) { if (entity == null) { return(null); } return(entity.Represent(representationContext)); }
protected override IUserReference Represent(UserReference entity, IRepresentationContext <long> representationContext = null) { if (entity == null) { return(null); } return(entity.Represent(representationContext)); }
public IIpV6Client Represent(IRepresentationContext context = null) { if (context == null) { context = new RepresentationContext(); } return(RepresentFactory.CreateIpClient(this, context)); }
public ICity Represent(IRepresentationContext context = null) { if (context == null) { context = new RepresentationContext(); } return(RepresentFactory.CreateCity(this, context)); }
internal static ILocation CreateLocation(Location location, IRepresentationContext context) { if (location == null) { return(null); } return(context.GetOrAdd(location.Id, () => new LocationImpl( location.AccuracyRadius, location.Latitude, location.Longitude, location.TimeZone))); }
private static IReadOnlyList <ICity> CreateCities(List <City> cities, IRepresentationContext context, ReprecentType type) { var result = new List <ICity>(capacity: cities.Count); if (cities.Count > 0) { for (var i = 0; i < cities.Count; i++) { result.Add(CreateCity(cities[i], context, type)); } } return(result); }
public IUserReference Represent(IRepresentationContext <long> representationContext) { if (representationContext == null) { representationContext = new RepresentationContext <long>(); } var role = default(IRole); if (Role != null) { role = Role.Represent(representationContext); } return(representationContext.GetOrAdd(Id, () => new UserReferenceImpl(UserId, role))); }
public IStarredTread Represent(IRepresentationContext <long> representationContext) { if (representationContext == null) { representationContext = new RepresentationContext <long>(); } var userReference = default(IUserReference); if (UserReference != null) { userReference = UserReference.Represent(representationContext); } return(representationContext.GetOrAdd(Id, () => new StarredThreadImpl(ThreadKey, FromCode, ToCode, TimeToMailling, userReference))); }
internal static ICity CreateCity(City city, IRepresentationContext context, ReprecentType type = ReprecentType.Full) { if (city == null) { return(null); } var counrty = default(ICounty); if (type == ReprecentType.Full) { if (city.County != null) { counrty = CreateCountry(city.County, context); } } return(context.GetOrAdd(city.Id, () => new CityImpl(city.Name, counrty))); }
internal static IContinent CreateContinent(Continent continent, IRepresentationContext context, ReprecentType type = ReprecentType.Full) { if (continent == null) { return(null); } var countries = new List <ICounty>(); if (type == ReprecentType.Full) { if (continent.Counties.Count > 0) { for (var i = 0; i < continent.Counties.Count; i++) { countries.Add(CreateCountry(continent.Counties[i], context, ReprecentType.Partial)); } } } return(context.GetOrAdd(continent.Id, () => new ContinentImpl(continent.Name, continent.Code, countries))); }
internal static IIpV4Client CreateIpClient(IpV4Client client, IRepresentationContext context, ReprecentType type = ReprecentType.Full) { var city = default(ICity); var country = default(ICounty); var continent = default(IContinent); var location = default(ILocation); switch (type) { case ReprecentType.Full: city = CreateCity(client.City, context); country = CreateCountry(client.County, context); continent = CreateContinent(client.Continent, context, ReprecentType.OnlyEntity); location = CreateLocation(client.Location, context); break; case ReprecentType.Partial: location = CreateLocation(client.Location, context); break; } return(context.GetOrAdd(client.Id, () => new IpV4ClientImpl(client.IpV4, city, country, continent, location))); }
internal static ICounty CreateCountry(County county, IRepresentationContext context, ReprecentType type = ReprecentType.Full) { if (county == null) { return(null); } var continent = default(IContinent); var cities = new List <ICity>(); switch (type) { case ReprecentType.Full: continent = CreateContinent(county.Continent, context, ReprecentType.OnlyEntity); CreateCities(county.Cities, context, ReprecentType.OnlyEntity); break; case ReprecentType.Partial: CreateCities(county.Cities, context, ReprecentType.OnlyEntity); break; } return(context.GetOrAdd(county.Id, () => new CountyImpl(county.Name, county.Code, continent, cities))); }
public IUser Represent(IRepresentationContext <string> representationContext) { return(new UserImpl(Id, Email)); }
protected override IIpV4Client Represent(IpV4Client entity, IRepresentationContext representationContext = null) { return(entity.Represent(representationContext)); }
public ILocation Represent(IRepresentationContext context = null) { return(RepresentFactory.CreateLocation(this, context)); }
protected abstract TEntityImpl Represent(TEntity entity, IRepresentationContext representationContext = null);
protected override ILocation Represent(Location entity, IRepresentationContext representationContext = null) { return(entity.Represent(representationContext)); }
protected override IStarredTread Represent(StarredThread entity, IRepresentationContext <long> representationContext = null) { return(entity.Represent(representationContext)); }
protected override ICity Represent(City entity, IRepresentationContext representationContext = null) { return(entity.Represent(representationContext)); }