Hi Saravana,
Actually you can still use the same code.
It still uses the same code, c# and with the same logic.
But, my suggestion, you need to consider about register both place (offline and online/server deployment) because for example, if the plugin involves the calculation or create a new record.
Real example, say you have 2 entities:
A. Transaction (Consumption)
B. Product
And in the Product, you have quantity on hand.
Then you implement plugin that are working both, offline and server., you register both deployment with trigger on create of the Transaction entity record.
And in offline mode, you have calculated the Quantity on hand field in the Product, everytime you have consumed and create new Transaction record it will reduce the Quantity by one.
So, for example, value (before consumed), it was 20.
Then, you have 5 transaction of consumption to reduce, so become 20-5 = 15.
So the balance of Quantity on hand in Product is 15 now.
Then, when you go Online, it will practically repeat the same things, create transaction record as well, it will trigger the plugin to run again, then it also call the plugin with the same code, then your field: Quantity on Hand, will also be reduced -1 for each transaction record created.
So, now your quantity on hand is 15 - 5 = 10, which is not correct and not as per users expectation.
Another example is, if you have offline plugin and online (server) plugin, that create another record, for example: After you create Account, then you create Task.
Then, it will trigger the offline plugin first, create new Task after create an Account.
When you go online, the Account also will be created in CRM that will trigger same code, that inside your code once Account was created, you create a Task.
So, you will have 2 records.
So this is the consideration to create both plugin. Usually, I only use offline plugin for validation purpose, for example: To Validate the Phone Number, to auto populate City by Postal Code, or to validate field value cannot be duplicate.
Hope this helps!
Thanks.