Posts

Showing posts from March, 2021

Disable Copy Paste And Mouse Right Click JavaScript, jQuery

Here is the code we can use to Disable Right Mouse Click Using jQuery: <script type="text/javascript"> $(document).ready(function () {     //Disable full page     $("body").on("contextmenu",function(e){         return false;     });           //Disable part of page     $("#id").on("contextmenu",function(e){         return false;     }); }); </script> Disable Cut, Copy, Paste Using jQuery: <script type="text/javascript"> $(document).ready(function () {     //Disable full page     $('body').bind('cut copy paste', function (e) {         e.preventDefault();     });           //Disable part of page     $('#id').bind('cut copy paste', function (e) {         e.preventDefault();     }); }); </script> Hope this will help!

DEFINE COMPOSITE KEY IN MODEL.(CORE, EF CODE FIRST)

Image
When there are composite keys in the database table and when you try to put data annotation it will throw below error Entity type ‘Orgmember’ has a composite primary key defined with data annotations. To set the composite primary key, use fluent API The above code will not work and throw an error Here is the solution to this problem Step 1: Modify your modal class like Step 2: Use the fluent API to set up a composite key.  

COMPILE .NET CORE CONSOLE APPLICATION AS .EXE FILE

Image
When we compile .NET Core Console Application it generates a DLL file instead of exe file for the building project. NET Core 3.0+ projects will now include an executable file for the platform you build on by default. This is just an executable and your main logic still remains in a  DLL file But .NET Core 3.0 also introduced single-file deployments so deploying with dotnet publish -r win-x64 -p:PublishSingleFile=True --self-contained false This will create a single executable (exe) file containing all your dependencies. we can change  --self-contained  to  true  to also include the .NET Core Runtime as well so .NET Core does not need to be installed globally on the target machine. We can also do this from Visual Studio Publish