fiogf49gjkf0d Sublogix will create the primary ID value automatically. However, you need to specify the entity type you are creating.
Like this:
var kalugaAbonent = _repository.Create<KalugaAbonent>(); // <-- or whatever the entity type is kalugaAbonent.RegNum = (short) abonent.REG_NUM; kalugaAbonent.ServerDir = (int) abonent.SERVER_DIR; kalugaAbonent.GuId = abonent.GUID; lock (_repository) { kalugaAbonent.Save(); }
As long as this entity is based on a normal SLX table, it will create the primary ID value for it when you save (but you do need to specify the entity type when you create, otherwise it will generate an error.
Not that you need this for standard saves like the above, but you can also create ID values with Sublogix using the following:
var newAccountId = Sublogix.Helpers.SalesLogixHelper.NewID<Account>();
BTW, what is the specific error text you were getting? |