We are a Salesforce CRM consulting, Salesforce implementation, Force.com development, CRM deployment & offshore support services provider. We are a group of expert consultants, developers, and administrators who are passionate about Salesforce. Our services extend to the development of enterprise apps on Force.com, CRM data migration, implementation, maintenance, integration, consulting, and many more. We relate with your vision and understand the problem you are facing. We use the best tools in the industry to ensure transparency. Try our two weeks of free Salesforce consultation and support services.
There is no doubt that the Salesforce platform comes with unlimited possibilities and has the potential to completely transform businesses. But it is also true that a successful implementation requires an experienced Salesforce consultant who has the required knowledge base and experience to learn diligently about your business model/processes and then build solutions around them. We are providing Salesforce offshore consultants starting from @$1800 per month.
JavaScript functions are reusable blocks of code that perform specific tasks. Defined using the function keyword or as arrow functions, they can accept parameters and return values. Functions enhance code organization, modularity, and reusability, allowing developers to execute the same logic multiple times throughout a program with ease.
Problem Statement: Extracting extended file properties, such as the Media Created Date, is necessary for certain applications. Utilizing the Microsoft.WindowsAPICodePack.Shell namespace facilitates this task efficiently.
Approach: Utilize the ShellObject class from the WindowsAPICodePack.Shell namespace to access extended file properties. Specifically, retrieve the Media Created Date using the System.Media.DateEncoded property.
using Microsoft.WindowsAPICodePack.Shell;
ShellObject shell = ShellObject.FromParsingName(path);
var mediaCreatedDate = shell.Properties.System.Media.DateEncoded;
Explanation: This code utilizes the ShellObject class to access extended file properties. It fetches the Media Created Date of a file specified by its path using the System.Media.DateEncoded property, providing crucial metadata for various applications.
Further resources
useContext
is a React Hook that lets you read and subscribe to context from your component. React Context is a way to manage state globally.
The useNavigate
hook from React Router returns a function that lets you navigate programmatically, for example in an effect:
import { useNavigate } from "react-router-dom";
function useLogoutTimer() {
const userIsInactive = useFakeInactiveUser();
const navigate = useNavigate();
useEffect(() => {
if (userIsInactive) {
fake.logout();
navigate("/session-timed-out");
}
}, [userIsInactive]);
}
Button click
import { useNavigate } from 'react-router-dom';
...
const navigate = useNavigate();
...
<Button onClick={() => navigate('../user', { replace: true })}>Register</Button>
Reference
To only update one field, we can simply change the update method to the following:
Person person = new Person {Id=4, Lastname="Miller"};
dbContext.Attach(person);
dbContext.Entry(person).Property(p => p.Lastname).IsModified = true;
dbContext.SaveChanges();
The above function first constructs the object with the specified Id
and updated Lastname
, and then appends the object; it then explicitly marks the Lastname
property as modified.
The generated UPDATE statement now looks like this
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
Executed DbCommand (8ms) [Parameters=[@p1='?' (DbType = Int32), @p0='?' (Size = 4000)], CommandType='Text', CommandTimeout='30']
UPDATE `Persons` SET `Lastname` = @p0
WHERE `Id` = @p1;
SELECT ROW_COUNT();
As shown in the EFCore log, only the Lastname
field is updated.
This approach can slightly improve performance because the SQL statement is smaller and the query execution on the database server can be faster.
See also the discussion at Stack Overflow How to update not every fields of an object using Entity Framework and EntityState.Modified
Logging is an essential part of application development for debugging, monitoring, and understanding the flow of execution, especially in complex systems. When logging in a C# method with parameters that need validation, it's crucial to follow best practices to ensure clear and useful log messages. Below is a sample demonstrating how to log and validate parameters in a C# method:
public bool ValidateAndProcessData(string data)
{
// Log the start of the method
_logger.LogInformation("ValidateAndProcessData method started");
// Validate input data
if (string.IsNullOrEmpty(data))
{
_logger.LogError("Input data is null or empty");
throw new ArgumentException("Input data cannot be null or empty", nameof(data));
}
try
{
// Process data
_logger.LogInformation("Processing data: {data}", data);
// Simulating processing time
System.Threading.Thread.Sleep(1000);
_logger.LogInformation("Data processed successfully");
return true;
}
catch (Exception ex)
{
// Log any exceptions that occur during processing
_logger.LogError(ex, "Error processing data: {data}", data);
throw; // Re-throw the exception for higher-level handling
}
finally
{
// Log the end of the method
_logger.LogInformation("ValidateAndProcessData method completed");
}
}
By following this sample, you ensure that your method logs relevant information about parameter validation and method execution, making it easier to debug and monitor your application's behavior.
C# is a strongly-typed language. It means we must declare the type of a variable that indicates the kind of values it is going to store, such as integer, float, decimal, text,
Additional reading at Data types in C# (tutorialsteacher.com)
C# includes specialized classes that store series of values or objects are called collections.
There are two types of collections available in C#: non-generic collections and generic collections.
The System.Collections
namespace contains the non-generic collection types and System.Collections.Generic
namespace includes generic collection types.
Additional reading at C# Generic & Non-generic Collections (tutorialsteacher.com)
In C#, a string is a series of characters that is used to represent text. It can be a character, a word or a long passage surrounded with the double quotes ". The following are string literals.
// String Literal Examples
"S"
"String"
"This is a string."
In a console apps, there is often a need to obtain user input from the console while ensuring that the input is not empty or only whitespace characters.
In this sample, we define a method GetUserInput
that takes an optional message parameter. It continuously prompts the user until a non-empty, non-whitespace input is provided.
static string GetUserInput(string message = "Please enter some input:")
{
string input;
do
{
Console.WriteLine(message);
input = Console.ReadLine()?.Trim();
} while (string.IsNullOrWhiteSpace(input));
return input;
}
Explanation:
message
parameter allows customizing input prompt message.Console.ReadLine()?.Trim()
reads user input and trims leading/trailing whitespace.?.
operator is used for null-conditional access, ensuring that Console.ReadLine()
doesn't throw a null reference exception if the input is null.do-while
loop ensures user input is not empty or whitespace.To filter out nullable strings and obtain only non-null strings, you can use LINQ Where
method along with a null check. Here's an example:
IEnumerable<string?> nullableStrings //
List<string> nonNullStringsList = nullableStrings
.Where(s => s != null) // Filter out null values
.Select(s => s!) // Convert nullable strings to non-nullable
.ToList(); // Convert IEnumerable to List
Where
to filter out null values and Select
to convert nullable strings to non-nullable strings (string!
indicates a non-nullable reference type in C# 8.0 and later).ToList()
to convert the filtered enumerable to a List<string>
.The JsonSerializer.Serialize
converts the value of a specified type into a JSON string.
using System.Text.Json;
var user = new User("Krish Jackon", "female", new MyDate(1985, 03, 30));
var json = JsonSerializer.Serialize(user);
Console.WriteLine(json);
The JsonSerializer.Deserialize
parses the text representing a single JSON value into an instance of a specified type.
using System.Text.Json;
string json = @"{""Name"":""Krish Jackon"", ""Gender"":""female"",
""DateOfBirth"":{""year"":1985,""month"":03,""day"":30}}";
var user = JsonSerializer.Deserialize<User>(json);
Resources to deserialize to dynamic object
In EF Core, joining a subquery with two columns (INNER JOIN table) can be achieved using LINQ syntax. Below is an example of how to do this:
var query = from user in context.Users
join post in context.Posts
on new { UserId = user.Id, IsPublished = true }
equals new { post.UserId, IsPublished = true }
select new
{
user.Username,
post.Title
};
In this example
Users
and Posts
tables on two columns (UserId
and a condition IsPublished
) using the equals
keyword.UserId = user.Id
, you are matching the UserId
column from the Post
entity with the Id
column from the User
entity.Additional reading at EF Core Join Query - TekTutorialsHub
To join a subquery (INNER JOIN table) in EF Core, you can use the Join
method along with LINQ expressions. Below is a example code snippet:
var query = from order in context.Orders
join orderItem in context.OrderItems
on order.OrderId equals orderItem.OrderId
where order.CustomerName == "John Doe"
select new
{
order.OrderId,
order.CustomerName,
orderItem.ProductName,
orderItem.Price
};
The expression on order.OrderId equals orderItem.OrderId
is used to specify the join condition between two tables/entities (Orders
and OrderItems
based on their related columns OrderId
.
Additional Reading at EF Core Inner Join (csharptutorial.net)
This code sample show how to insert an entity Element
without updating related entities.
_dbContext.Entry<Element>(element).State = EntityState.Added;
// Set the state of the Category navigation property of 'element' to Unchanged
_dbContext.Entry<Category>(element.Category).State = EntityState.Unchanged;
// Detach all roles associated with the 'element' from the DbContext
element.Roles.ToList().ForEach(r => _dbContext.Entry<Role>(r).State = EntityState.Detached);
// Mark the Roles collection of 'element' as not modified to prevent updating roles
_dbContext.Entry<Element>(element).Collection(r => r.Roles).IsModified = false;
await _dbContext.SaveChangesAsync();
element
's associated Category
object to Unchanged in the _dbContext
. This indicates that the Category
object is not modified and should not be updated in the database.Role
, it sets the state to Detached
. Detaching an entity means it is no longer tracked by the EF Core context for changes.IsModified
property of the Roles
collection in the element
is explicitly set to false
. This indicates to EF Core that the Roles
collection has not been modified and should not be updated in the database.To inspect the SQL generated by your LINQ query, you can convert the LINQ query to a SQL string using the ToQueryString()
method.
// Example LINQ query
var query = from o in context.Orders;
// Convert LINQ query to SQL string
string sqlQuery = query.ToQueryString();
Console.WriteLine(sqlQuery);
This code snippet demonstrates how to generate and inspect the SQL query string using LINQ in C# useful for debugging and optimization purposes.
To group in EF Core using LINQ query syntax, use the group by
clause followed by the grouping key and aggregate functions as needed. For example, to group a collection of items by a property called "Category" and count the items in each group:
var groupedData = from item in dbContext.Items
group item by item.Category into grouped
select new { Category = grouped.Key, Count = grouped.Count() };
Iqra Technology is an IT Solutions and Services Company. We are a salesforce and Microsoft partner company. We aim to provide cost-effective IT services within the customer’s budget range. We scrutinize, design, and develop solutions custom-made for the business necessities. We deliver services in various domains including CRM, ERP, e-commerce, CMS, business intelligence, web development, customized applications, portals, mobile apps, & RPA technologies. We provide IT services starting from $2100 per month and 2 weeks free trial. https://iqratechnology.com/
If you just switched to the new Windows version, here are some of the most interesting Windows 11 features that you should know about:
Who doesn't know this? You have something on your mind and want to tell the other person how you feel and what's on your mind. However, the other person, unfortunately, does not listen properly and you do not feel understood.
Unfortunately, most people are poor listeners. Good listeners have often undergone special training or have made listening to their profession. But what does good listening actually mean? How can you listen better and give your counterpart an appreciative feeling? In the following, I would like to show you three tips that will help you become a better listener.
A large proportion of German employees suffer from recurring chronic back pain, which, according to medical experts, is mainly caused by immobile sitting in everyday working life.
In the following, you will find out what a vital workday can do for your health. First, however, you should start at the basis of your every day (work) life.
Do you not know where to go with you because of the heat? Rescue is at hand! According to traditional Chinese medicine, these foods provide a large portion of cooling.
The fan has given up the ghost, your feet are boiling, and you don't know if that thing on your neck is a head or a hotplate? We feel you! We can't offer you a nice igloo in the Arctic at the moment, but at least the heat buildup in your body can be solved with smart decisions when eating.
Doesn’t it make sense then to try to save as much of your hard-earned money as possible? The less you spend, the more you have.
Here are some money tips you can use to save big on many of your expenses.
Vasily Alekseyev was tricked into lifting 500 pounds over his head.
Until 1970, many weightlifters had only come close to cracking that psychological barrier.
So when his trainers told him that the bar was loaded with slightly less than 500 pounds, a weight he’d lifted before, he threw it up like a matchstick.
Only they had lied—he’d actually lifted 500.5 pounds. Over the next seven years, he continued to smash records, topping out at 564 before retiring.
Because seeing is believing, many others started lifting 500+ soon after.
Remember Roger Bannister? Until 1954, everyone believed a human couldn't run a mile in under four minutes. Then Roger did it, and his record stood for only 46 days. In the next 50 years, more than a thousand runners beat the four-minute mile.
What changed? Only a belief in what’s possible.
A few everyday things make us look immediately unattractive to our counterpart - at least, that's what science says.
Do you get too little sleep and are often in a bad mood? Then watch out! These and other everyday things that seem supposedly "normal" to us have a negative impact on your attractiveness. Scientists have found out which behaviors don't go down well and cast a bad light on us:
Walking barefoot is the natural way for humans to walk why it's worthwhile to go barefoot more often.
For thousands of years, our ancestors stomped around barefoot. Only recently have people started to squeeze into socks and shoes with rubber soles, completely isolating themselves from the earth's surface - yet walking with bare feet brings so many health benefits. Because walking barefoot...
Too many tasks and too little time is a permanent condition for you? Do you feel stressed and are unproductive? Poor time management is often to blame. With these 5 tips, you'll finally get the hang of it.
Everyone has 24 hours in a day, yet some people seem to use them better than others. Those who cultivate poor time management struggle to complete their tasks. The consequences: Constant stress and declining productivity. These tips (from Focus Online) show you how good time management works and bring peace back into your workday.
Our society places great value on multitasking. So, too, are our work environments designed for multitasking: Now more than ever, we use computers and networks that offer instant messaging, email, and other "productive" tools. We are constantly jumping back and forth between them.
Multitasking includes three different types:
Performing two or more tasks simultaneously.
Switching back and forth between tasks.
Performing a series of tasks in rapid succession.
While this way of working seems normal to many people, multitasking is a disadvantage. If we use single-tasking instead and consciously approach each project "task-by-task," we can be very productive.
The fastest way to get many things done is to do one thing at a time.
At least two liters a day should be. You should definitely drink before sports ... There are plenty of myths about drinking. But which ones are really true?
Many of us find it difficult to follow through on all work tasks and figure out how to continue to be as productive as possible after an extended period of physical and social isolation. With a little mindfulness, planning ahead, and acknowledging what's actually going well, it's possible to jumpstart productivity with new strategies. These six simple methods will help you be more productive in your workday:
This is what happens when you drink water in the morning on an empty stomach.
These 7 things happen when you drink water after waking up on an empty stomach, from weight loss to visibly healthier hair.
We hear again and again that sufficient liquid is important for our body. But what happens when water is drunk directly after getting up? We'll tell you:
How would the world look like 5, 10, or 15 years from now? Well, indeed, no one can predict.
Monitoring the changing pattern of technological usage & growth can help understand how the professional world may change in the future.
A career you may want to pursue, or a career you already have may shape up to be quite a boom in years to come.
In this blog, we shall shed some light on in-demand careers which we believe shall grow in years to come.