its kind of weird whenever i inquire my table it will automatically pass a sql update statement to update the invdt and invduedt . it will pass the sql update statement For all the records fetched.
what i noticed is that statement is executed when data is passed from saleappservice to the controller
return new ListResultOutput<Salemastdto>(saledtos);
exec sp_executesql N'UPDATE [dbo].[Sale_Mast] SET [Invdt] = @0, [Invduedt] = @1, [LastModificationTime] = @2, [LastModifierUserId] = @3, [CreationTime] = @4 WHERE (([TenantId] = @5) AND ([Invno] = @6)) ',N'@0 datetime2(7),@1 datetime2(7),@2 datetime2(7),@3 bigint,@4 datetime2(7),@5 int,@6 nvarchar(50)',@0='2016-07-14 00:00:00',@1='2016-07-17 00:00:00',@2='2016-08-27 15:01:59.7960039',@3=3,@4='2016-07-14 12:38:15.5270000',@5=2,@6=N'099'
hope we get the reply soon :)
I was using the database generated unique index for id .But I have a following scenario
Every Tenant have unique InvoiceNo
Tenant 1 --- invoice 001 Tenant 2 --- invoice 001
if i make TenantID and InvoiceNo as composite primary key then I dont need to write much code if I use id then every time i have to check that Tenant in use have this invoice or not before entrying the new invoice .
please let me know the better way to implement the above condition
thanks
is there any recommended entity structure for multi tenancy in boilerplate?
should we use composite key or we should go for unique identity?
I was using composite primary key then I have issues with soft delete .
if using unique identity then hard to maintain uniqueness per tenant.
Please recommend the most preferred way
can u be more specific on "<span style="color:#FF0000">not easy</span>" part .Is there any example?
where is the best place to put my business logics.do u have any example?
1 -How to reverse softdelete? 2- is there anyway that certain user like admin can see soft delete and and reverse it 3- how to force permanent delete in certain condition
public class Accountmain : FullAuditedEntity, IMustHaveTenant {
[Required]
public virtual int TenantId { get; set; }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public virtual int Amslno { get; set; }
[Required]
[StringLength(50)]
public virtual string Accmain { get; set; }
[Required]
[StringLength(2)]
public virtual string Posting { get; set; }
[Required]
[StringLength(2)]
public virtual string Side { get; set; }
}
above is my entity .when i am adding new record id is always zero in database .while deleting if I provide only Amslno its not working but if all the elements are provided then delete is working perfectly .
i have enabled--- return RedirectToAction("Index", "Home", new {area = "Mpa"}); for now.
can u elaborate on which part I need to delete ?
why the site goes to Application#/tenant/dashboard instead mpa/dashboard by default?what is the difference between them?