Gabriel #1 entity:TEntity = TEntity(Nlink.Value()) But only do it if you're 100% sure it's a TEntity. If it's not a TEntity, you will have a null object.