Lazy Loading Variable Error

Lazy loading variable error

Try let entity = NSEntityDescription.entityForName(EntityNames.User, inManagedObjectContext: self.context)

Note I'm using self.context instead of just context. This builds for me in a playground.

Lazy var giving 'Instance member can not be used on type' error

Try that :

class SomeClass {
var coreDataStuff = CoreDataStuff!
lazy var somethingElse: SomethingElse = SomethingElse(coreDataStuff: self.coreDataStuff)
}

It is important to precise the type of your lazy var and to add self. to the argument you pass

Weird SQL Server lazy loading of table variables?

Just because an error has occurred, that doesn't stop the stored proc from progressing. You won't see the error message because by default, SSMS shows the result grid until the query has finished processing.

This shows results for 10 seconds before switching to the error message:

RAISERROR('Error',16,1)
select top 1000 * from sys.objects so1,sys.objects so2,sys.objects so3
WAITFOR DELAY '00:00:10'

If you want the stored proc to exit early if an error occurs, you have to bail out early. You could re-write your insert to be something like:

declare @cross_reference table (
context varchar(20) not null
, value1 varchar(10) not null
, value2 varchar(10) not null
)

insert into @cross_reference (context,value1,value2)
values ('map', 'from_value', 'to_value'),
('map', 'from_value', 'to_value'),
('map', 'from_value_xxxxx', 'to_value_xxxxxxx');
if @@ERROR !=0 or @@ROWCOUNT !=3 return

Or if you don't know the row count, change the condition to @@ROWCOUNT = 0

(Or, of course, use TRY/CATCH - but I've not written much code using them myself yet, so can't just knock out an example)

Your current code has made each insert independent - so those inserts that can work, do, and those that cannot, produce error messages. Then it carries on with processing your final query. Because the table is used in a LEFT JOIN, of course it doesn't matter to the final query whether any rows exist in the table variable.

Lazy loading: Can't load dynamic module

Ok, with the help of @Ajeet Shah I've solved my problem.

I've created a new property with the component name instead and I did that :

const WidgetComponent = React.lazy(() => import(`../../../widgets/${widget.component}`));

Not the most elegant solution, but it works.



Related Topics



Leave a reply



Submit