Exemplo n.º 1
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     if (other != null)
     {
         return(this.Equals(other as WingedBagNet));
     }
     return(false);
 }
Exemplo n.º 2
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     if (other != null)
     {
         return(this.Equals(other as SimpleTrapDredge));
     }
     return(false);
 }
Exemplo n.º 3
0
 public bool Equals(IIdentifiableEntity <Guid> other)
 {
     if (other == null)
     {
         return(false);
     }
     return(this.id.Equals(other.Identity));
 }
Exemplo n.º 4
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     if (other != null)
     {
         return(this.Equals(other as StandardPlanktonNet));
     }
     return(false);
 }
    //Here would be constructor injection of INotificationService, IAuthorizationService and IPersistenceService

    void AddSomeModelAndNotify(User user, SomeModel model)
    {
        if (authorizationService.IsAuthorized(user))
        {
            IIdentifiableEntity entity = persistenceService.AddSomeEntity(model);
            persistenceService.SaveChanges();
            // Pass reference entity to Notify.
            notificationService.Notify(user, entity);
        }
        else
        {
            throw new UnauthorizedException();
        }
    }
Exemplo n.º 6
0
        public Identifier Create(IIdentifiableEntity entity)
        {
            var entityType = entity.GetType();
            var prefix     = this.prefixes.ContainsKey(entityType)
                ? this.prefixes[entity.GetType()]
                : UnknownEntityPrefix;

            var guid       = Guid.NewGuid();
            var identifier = ConvertGuid(guid, prefix);

#if TESTINGONLY
            LastCreatedIds.Add(identifier, guid.ToString("D"));
#endif

            return(identifier.ToIdentifier());
        }
Exemplo n.º 7
0
        public Identifier Create(IIdentifiableEntity entity)
        {
            var random = Convert.ToBase64String(Guid.NewGuid().ToByteArray())
                         .Replace("+", string.Empty)
                         .Replace("/", string.Empty)
                         .Replace("=", string.Empty);

            var entityType = entity.GetType();

            if (this.prefixes.ContainsKey(entityType))
            {
                var prefix = this.prefixes[entity.GetType()];
                return($"{prefix}{Delimiter}{random}".ToIdentifier());
            }

            return($"{UnknownEntityPrefix}{Delimiter}{random}".ToIdentifier());
        }
 /// <summary>
 ///     Gets the creation date of this entity.
 ///     Short for <see cref="Snowflake.CreatedAt"/> from <see cref="IIdentifiableEntity.Id"/>.
 /// </summary>
 /// <returns>
 ///     The date at which the entity was created.
 /// </returns>
 public static DateTimeOffset CreatedAt(this IIdentifiableEntity entity)
 => entity.Id.CreatedAt;
Exemplo n.º 9
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     return(this.Equals(other as CatchEffort));
 }
Exemplo n.º 10
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     return(this.Equals(other as ProjectStatusType));
 }
Exemplo n.º 11
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     return(this.Equals(other as Instrument));
 }
Exemplo n.º 12
0
 public bool Equals(IIdentifiableEntity<CompoundIdentity> other)
 {
     return this.Equals(other as SiteAliasScheme);
 }
Exemplo n.º 13
0
 public bool Equals(IIdentifiableEntity <Guid> other)
 {
     return(this.Equals(other as TreeSample));
 }
Exemplo n.º 14
0
 public Identifier Create(IIdentifiableEntity entity)
 {
     return(this.id);
 }
Exemplo n.º 15
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     return(this.Equals(other as WaterQualityDeployment));
 }
Exemplo n.º 16
0
 public Identifier Create(IIdentifiableEntity entity)
 {
     return(null);
 }
Exemplo n.º 17
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     return(this.Equals(other as VegSurvey));
 }
Exemplo n.º 18
0
 public bool Equals(IIdentifiableEntity <Guid> other)
 {
     return(this.Equals(other as Fish));
 }
Exemplo n.º 19
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     return(this.Equals(other as FieldTeam));
 }
Exemplo n.º 20
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     return(this.Equals(other as SamplingEvent));
 }
Exemplo n.º 21
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     return(this.Equals(other as Sensor));
 }
Exemplo n.º 22
0
 public Identifier Create(IIdentifiableEntity entity)
 {
     return(Guid.NewGuid().ToString("D").ToIdentifier());
 }
Exemplo n.º 23
0
 public bool Equals(IIdentifiableEntity <Guid> other)
 {
     return(this.Equals(other as CatchMetric));
 }
Exemplo n.º 24
0
 public bool Equals(IIdentifiableEntity <Guid> other)
 {
     return(this.Equals(other as NetHaulEvent));
 }
Exemplo n.º 25
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     return(this.Equals(other as Organization));
 }
Exemplo n.º 26
0
 public bool Equals(IIdentifiableEntity <CompoundIdentity> other)
 {
     return(this.Equals(other as TaxaUnitType));
 }