When $C_v=\left.\frac {\delta Q} {dT}\right|_v=\left.\frac {\partial E} {\partial T}\right|_v$? The definition of specific heat at constant volume is $C_v=\left.\frac {\delta Q} {dT}\right|_v$  but sometimes I find this expression instead: $C_v=\left.\frac {\partial E} {\partial T}\right|_v$ . I guess that the reason why these two expression are both used is that they are equivalent, however I don't know how to demonstrate it.
I tried to demonstrate the equivalence by myself but I was able to do it only assuming $\delta W=-PdV$ indeed in this case: $dE=\delta Q +\delta W=\delta Q - PdV \rightarrow \left.dE\right|_v=\delta Q$ so it follow
$C_v=\left.\frac {\delta Q} {dT}\right|_v=\left.\frac {\partial E} {\partial T}\right|_v$ .
However, when I don't assume $\delta W=-PdV$ it becomes impossible for me to show that $C_v=\left.\frac {\delta Q} {dT}\right|_v=\left.\frac {\partial E} {\partial T}\right|_v$. Consider for example the case of a paramagnetic materials, since it can be magnetized the expression for the work should be $\delta W=-PdV+BdM$ where $M$ is the magnetization and $B$ is the magnetic field.
Even in this case i think the expression $C_v=\left.\frac {\partial E} {\partial T}\right|_v$ is valid. Why?
Note: in the last example I think that the independent variables are $V$ and $T$ while the number of particle and the magnetic field are taken constant and that $M=M(V,T)$
 A: $\delta Q$ is a non-exact differential form.
According to the First Law of Thermodynamics
$$\delta Q=dU+\delta W$$
Where $\delta W$ is the work differential form and $dU$ is the differential of the internal, which is an exact differential form. For mechanical work only $\delta W=pdV$.
Let's consider a $pVT$ system. To define specific heat at constant volume, consider $(T,V)$ as independent variables, then the heat differential form is
$$\delta Q=\underbrace{\left(\frac{\partial U}{\partial V}\right)_TdV+\left(\frac{\partial U}{\partial T}\right)_VdT}_{dU}+p(T,V)dV$$
Specific heat at constant volume $C_v$ is defined as the component along $dT$ of the differential form $\delta Q^1$, i.e.
$$C_v=\left(\frac{\partial U}{\partial T}\right)_V \tag{A}$$
To emphasize the definition, writing heat differential form more generally as
$$\delta Q=f(T,V)dT+g(T,V)dV$$
Specific heat at constant volume is defined as the function $f(T,V)$. As you can see above, this coefficient is equal to $(A)$.

$^1$This is the reason why the other variable is $V$ and not $p$, so that the volume is fixed when differentiating with respect to T.
A: The formal definition of the specific heat at constant volume is
$$c_{v}=\biggl (\frac{\partial u}{\partial T}\biggr )_v$$
Your last expression does not show that the partial derivative is at constant volume.
Hope this helps.
